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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.