pub fn from_sql_asset(
        table_value: &SqlAsset,
        connection: &SqliteConnection,
    ) -> Result<Self, SqlCacheError> {
        let (known_inflation, unknown_inflation) =
            read_inflation(table_value, connection)?;

        let known_table_issues =
            SqlIssue::belonging_to(table_value).load::<SqlIssue>(connection)?;

        let mut known_issues = vec![];

        for issue in known_table_issues {
            known_issues.push(Issue::from_sql_issue(
                issue,
                table_value.fractional_bits[0],
            )?)
        }

        Ok(Self {
            id: ContractId::from_hex(&table_value.contract_id[..])?,
            ticker: table_value.ticker.clone(),
            name: table_value.asset_name.clone(),
            description: table_value.asset_description.clone(),
            supply: Supply::from_sql_asset(&table_value),
            chain: bp::Chain::from_str(&table_value.chain[..])?,
            fractional_bits: table_value.fractional_bits[0],
            date: table_value.asset_date,
            known_issues: known_issues,
            known_inflation: known_inflation,
            unknown_inflation: unknown_inflation,
            known_allocations: read_allocations(&table_value, connection)?,
        })
    }
/// Create an Asset structure from an sqlite asset table entry.
/// This fetches all the other tables for entries associated with the given
/// asset and recreates the full Asset structure. This should be used
/// while reading Asset data from database table.
Create an Asset structure from an sqlite asset table entry.
This fetches all the other tables for entries associated with the given
asset and recreates the full Asset structure. This should be used
while reading Asset data from database table.
Create an Asset structure from an sqlite asset table entry . This fetches all the other tables for entries associated with the given asset and recreates the full Asset structure . This should be used while reading Asset data from database table .
pub fn from_sql_asset(
        table_value: &SqlAsset,
        connection: &SqliteConnection,
    ) -> Result<Self, SqlCacheError> {
        let (known_inflation, unknown_inflation) =
            read_inflation(table_value, connection)?;
        let known_table_issues =
            SqlIssue::belonging_to(table_value).load::<SqlIssue>(connection)?;
        let mut known_issues = vec![];
        for issue in known_table_issues {
            known_issues.push(Issue::from_sql_issue(
                issue,
                table_value.fractional_bits[0],
            )?)
        }
        Ok(Self {
            id: ContractId::from_hex(&table_value.contract_id[..])?,
            ticker: table_value.ticker.clone(),
            name: table_value.asset_name.clone(),
            description: table_value.asset_description.clone(),
            supply: Supply::from_sql_asset(&table_value),
            chain: bp::Chain::from_str(&table_value.chain[..])?,
            fractional_bits: table_value.fractional_bits[0],
            date: table_value.asset_date,
            known_issues: known_issues,
            known_inflation: known_inflation,
            unknown_inflation: unknown_inflation,
            known_allocations: read_allocations(&table_value, connection)?,
        })
    }
pub fn from_sql_asset ( table_value : & SqlAsset , connection : & SqliteConnection , ) -> Result < Self , SqlCacheError > { let ( known_inflation , unknown_inflation ) = read_inflation ( table_value , connection ) ? ; let known_table_issues = SqlIssue :: belonging_to ( table_value ) . load :: < SqlIssue > ( connection ) ? ; let mut known_issues = vec ! [ ] ; for issue in known_table_issues { known_issues . push ( Issue :: from_sql_issue ( issue , table_value . fractional_bits [ 0 ] , ) ? ) } Ok ( Self { id : ContractId :: from_hex ( & table_value . contract_id [ .. ] ) ? , ticker : table_value . ticker . clone ( ) , name : table_value . asset_name . clone ( ) , description : table_value . asset_description . clone ( ) , supply : Supply :: from_sql_asset ( & table_value ) , chain : bp :: Chain :: from_str ( & table_value . chain [ .. ] ) ? , fractional_bits : table_value . fractional_bits [ 0 ] , date : table_value . asset_date , known_issues : known_issues , known_inflation : known_inflation , unknown_inflation : unknown_inflation , known_allocations : read_allocations ( & table_value , connection ) ? , } ) }
Create an Asset structure from an sqlite asset table entry.
Create an Asset structure from an sqlite asset table entry .
table_value
&SqlAsset
connection
&SqliteConnection
table_value
&SqlAsset
connection
&SqliteConnection