Trait leetcode_api::dao::InsertToDB
source · 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§
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 Methods§
fn on_conflict() -> OnConflict
Provided Methods§
fn to_model(&self, _info: Self::Value) -> Self::Model
sourcefn insert_to_db(
&mut self,
_info: Self::Value
) -> impl Future<Output = ()> + Send
fn insert_to_db( &mut self, _info: Self::Value ) -> impl Future<Output = ()> + Send
Insert with extra logic
_info
: extra info
fn to_activemodel(&self, value: Self::Value) -> Self::ActiveModel
sourcefn insert_one(&self, info: Self::Value) -> impl Future<Output = ()> + Send
fn insert_one(&self, info: Self::Value) -> impl Future<Output = ()> + Send
Insert One
_info
: extra info
fn insert_many(value: Vec<Self::ActiveModel>) -> impl Future<Output = ()> + Send
Object Safety§
This trait is not object safe.