carbon-swig-decoder 0.12.0

Swig Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.

use super::SwigAccount;

pub struct SwigAccountsMigration;

impl sqlx_migrator::Migration<sqlx::Postgres> for SwigAccountsMigration {
    fn app(&self) -> &str {
        "swig"
    }

    fn name(&self) -> &str {
        "swig_accounts"
    }

    fn operations(&self) -> Vec<Box<dyn sqlx_migrator::Operation<sqlx::Postgres>>> {
        vec![]
    }

    fn parents(&self) -> Vec<Box<dyn sqlx_migrator::Migration<sqlx::Postgres>>> {
        vec![]
    }
}

pub struct SwigAccountWithMetadata(pub SwigAccount, pub carbon_core::account::AccountMetadata);

impl From<(SwigAccount, carbon_core::account::AccountMetadata)> for SwigAccountWithMetadata {
    fn from(value: (SwigAccount, carbon_core::account::AccountMetadata)) -> Self {
        SwigAccountWithMetadata(value.0, value.1)
    }
}

#[async_trait::async_trait]
impl carbon_core::postgres::operations::Insert for SwigAccountWithMetadata {
    async fn insert(&self, _pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
        let SwigAccountWithMetadata(_account, _metadata) = self;

        unreachable!("No accounts to decode")
    }
}

#[async_trait::async_trait]
impl carbon_core::postgres::operations::Upsert for SwigAccountWithMetadata {
    async fn upsert(&self, _pool: &sqlx::PgPool) -> carbon_core::error::CarbonResult<()> {
        let SwigAccountWithMetadata(_account, _metadata) = self;
        unreachable!("No accounts to decode")
    }
}