pub trait ModelUtils: Serialize + Sized {
    type ActiveModel: ActiveModelTrait<Entity = Self::Entity> + Send + From<Self::Model>;
    type Entity: EntityTrait;
    type Model: ModelTrait + DeserializeOwned;

    // Required method
    fn on_conflict() -> OnConflict;

    // Provided methods
    fn to_model(&self) -> AppResult<Self::Model> { ... }
    fn to_db<'life0, 'life1, 'async_trait>(
        &'life0 self,
        db: &'life1 DatabaseConnection
    ) -> Pin<Box<dyn Future<Output = AppResult<InsertResult<Self::ActiveModel>>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn post_multi_insert<'life0, 'async_trait>(
        _db: &'life0 DatabaseConnection,
        _objects: Vec<Self>
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn multi_insert<'life0, 'async_trait>(
        db: &'life0 DatabaseConnection,
        objects: Vec<Self>
    ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn get_active_model(&self) -> AppResult<Self::ActiveModel> { ... }
}

Required Associated Types§

Required Methods§

Provided Methods§

source

fn to_model(&self) -> AppResult<Self::Model>

source

fn to_db<'life0, 'life1, 'async_trait>( &'life0 self, db: &'life1 DatabaseConnection ) -> Pin<Box<dyn Future<Output = AppResult<InsertResult<Self::ActiveModel>>> + Send + 'async_trait>>where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn post_multi_insert<'life0, 'async_trait>( _db: &'life0 DatabaseConnection, _objects: Vec<Self> ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,

source

fn multi_insert<'life0, 'async_trait>( db: &'life0 DatabaseConnection, objects: Vec<Self> ) -> Pin<Box<dyn Future<Output = AppResult<()>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait,

source

fn get_active_model(&self) -> AppResult<Self::ActiveModel>

Implementors§