use {
carbon_core::graphql::primitives::{I64, U8},
juniper::GraphQLObject,
};
#[derive(Debug, Clone, GraphQLObject)]
#[graphql(name = "ProgramVersion")]
pub struct ProgramVersionGraphQL {
pub account_metadata: crate::accounts::graphql::AccountMetadataGraphQL,
pub version: U8,
pub bump: U8,
pub updated: I64,
}
impl TryFrom<crate::accounts::postgres::ProgramVersionRow> for ProgramVersionGraphQL {
type Error = carbon_core::error::Error;
fn try_from(row: crate::accounts::postgres::ProgramVersionRow) -> Result<Self, Self::Error> {
Ok(Self {
account_metadata: row.account_metadata.into(),
version: carbon_core::graphql::primitives::U8((*row.version) as u8),
bump: carbon_core::graphql::primitives::U8((*row.bump) as u8),
updated: carbon_core::graphql::primitives::I64(row.updated),
})
}
}