Skip to main content

AssetHandler

Trait AssetHandler 

Source
pub trait AssetHandler {
    // Required methods
    fn insert_asset<'life0, 'life1, 'async_trait>(
        &'life0 self,
        asset: &'life1 Asset,
    ) -> Pin<Box<dyn Future<Output = Result<i32, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_asset_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        asset: &'life1 Asset,
    ) -> Pin<Box<dyn Future<Output = Option<i32>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_asset_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Asset, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_asset_by_isin<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Asset, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_all_assets<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Asset>, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_asset_list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetSelector>, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_asset<'life0, 'life1, 'async_trait>(
        &'life0 self,
        asset: &'life1 Asset,
    ) -> Pin<Box<dyn Future<Output = Result<(), DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_asset<'life0, 'async_trait>(
        &'life0 self,
        id: i32,
    ) -> Pin<Box<dyn Future<Output = Result<(), DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_all_currencies<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Currency>, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_currency_list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetSelector>, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_or_new_currency<'life0, 'async_trait>(
        &'life0 self,
        iso_code: CurrencyISOCode,
    ) -> Pin<Box<dyn Future<Output = Result<Currency, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_or_new_currency_with_digits<'life0, 'async_trait>(
        &'life0 self,
        iso_code: CurrencyISOCode,
        rounding_digits: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Currency, DataError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Handler for globally available data of transactions and related data

Required Methods§

Source

fn insert_asset<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 Asset, ) -> Pin<Box<dyn Future<Output = Result<i32, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_asset_id<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 Asset, ) -> Pin<Box<dyn Future<Output = Option<i32>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_asset_by_id<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = Result<Asset, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_asset_by_isin<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Asset, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_all_assets<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Asset>, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a list of all assets ordered by name

Source

fn get_asset_list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetSelector>, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return AssetSelector for all assets

Source

fn update_asset<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 Asset, ) -> Pin<Box<dyn Future<Output = Result<(), DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn delete_asset<'life0, 'async_trait>( &'life0 self, id: i32, ) -> Pin<Box<dyn Future<Output = Result<(), DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_all_currencies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Currency>, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_currency_list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AssetSelector>, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a list of currencies as list of AssetSelectors

Source

fn get_or_new_currency<'life0, 'async_trait>( &'life0 self, iso_code: CurrencyISOCode, ) -> Pin<Box<dyn Future<Output = Result<Currency, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Either read currency from database or create new currency and store it in database with default rounding digits

Source

fn get_or_new_currency_with_digits<'life0, 'async_trait>( &'life0 self, iso_code: CurrencyISOCode, rounding_digits: i32, ) -> Pin<Box<dyn Future<Output = Result<Currency, DataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Either read currency from database or create new currency and store it in database. If currency exists already, ignore rounding errors.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl AssetHandler for PostgresDB

Handler for globally available Asset data