finql_data/
asset_handler.rs1use async_trait::async_trait;
2
3use super::DataError;
4use crate::asset::Asset;
5use crate::currency::Currency;
6
7#[async_trait]
9pub trait AssetHandler {
10 async fn insert_asset(&self, asset: &Asset) -> Result<usize, DataError>;
12 async fn insert_asset_if_new(
13 &self,
14 asset: &Asset,
15 rename_asset: bool,
16 ) -> Result<usize, DataError>;
17
18 async fn get_asset_id(&self, asset: &Asset) -> Option<usize>;
19 async fn get_asset_by_id(&self, id: usize) -> Result<Asset, DataError>;
20 async fn get_asset_by_isin(&self, id: &str) -> Result<Asset, DataError>;
21 async fn get_all_assets(&self) -> Result<Vec<Asset>, DataError>;
23 async fn update_asset(&self, asset: &Asset) -> Result<(), DataError>;
24 async fn delete_asset(&self, id: usize) -> Result<(), DataError>;
25 async fn get_all_currencies(&self) -> Result<Vec<Currency>, DataError>;
27}