pub trait InsertToDB: Sized {
    type Value: Into<Value> + Send;
    type Entity: EntityTrait;
    type Model: ModelTrait + Default + IntoActiveModel<Self::ActiveModel>;
    type ActiveModel: ActiveModelTrait<Entity = Self::Entity> + Send + From<Self::Model>;

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

    // Provided methods
    fn to_model(&self, _info: Self::Value) -> Self::Model { ... }
    fn insert_to_db(
        &mut self,
        _info: Self::Value
    ) -> impl Future<Output = ()> + Send { ... }
    fn to_activemodel(&self, value: Self::Value) -> Self::ActiveModel { ... }
    fn insert_one(&self, info: Self::Value) -> impl Future<Output = ()> + Send { ... }
    fn insert_many(
        value: Vec<Self::ActiveModel>
    ) -> impl Future<Output = ()> + Send { ... }
}

Required Associated Types§

Required Methods§

source

fn on_conflict() -> OnConflict

Provided Methods§

source

fn to_model(&self, _info: Self::Value) -> Self::Model

source

fn insert_to_db( &mut self, _info: Self::Value ) -> impl Future<Output = ()> + Send

Insert with extra logic

  • _info: extra info
source

fn to_activemodel(&self, value: Self::Value) -> Self::ActiveModel

source

fn insert_one(&self, info: Self::Value) -> impl Future<Output = ()> + Send

Insert One

  • _info: extra info
source

fn insert_many(value: Vec<Self::ActiveModel>) -> impl Future<Output = ()> + Send

Object Safety§

This trait is not object safe.

Implementors§