ModelRepository

Trait ModelRepository 

Source
pub trait ModelRepository<DB: Database>: DatabaseRepository<DB> {
    // Required methods
    fn get_all_models<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_model_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_model_by_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model: &'life1 Model,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_model<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model: &'life1 Model,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_model<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn search_models<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        limit: Option<i64>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_models_by_type<'life0, 'life1, 'async_trait>(
        &'life0 self,
        model_type: &'life1 ModelType,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_models_by_provider<'life0, 'life1, 'async_trait>(
        &'life0 self,
        provider: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

模型数据库仓库

Required Methods§

Source

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

获取所有模型

Source

fn get_model_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Model>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

根据ID获取模型

Source

fn get_model_by_name<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Model>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

根据名称获取模型

Source

fn create_model<'life0, 'life1, 'async_trait>( &'life0 self, model: &'life1 Model, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

创建新模型

Source

fn update_model<'life0, 'life1, 'async_trait>( &'life0 self, model: &'life1 Model, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

更新模型

Source

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

删除模型

Source

fn search_models<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, limit: Option<i64>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

搜索模型

Source

fn get_models_by_type<'life0, 'life1, 'async_trait>( &'life0 self, model_type: &'life1 ModelType, ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

按类型获取模型

Source

fn get_models_by_provider<'life0, 'life1, 'async_trait>( &'life0 self, provider: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Model>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

按提供商获取模型

Implementors§