Trait sea_orm::entity::ActiveModelTrait [−][src]
pub trait ActiveModelTrait: Clone + Debug {
type Entity: EntityTrait;
fn take(
&mut self,
c: <Self::Entity as EntityTrait>::Column
) -> ActiveValue<Value>;
fn get(
&self,
c: <Self::Entity as EntityTrait>::Column
) -> ActiveValue<Value>;
fn set(&mut self, c: <Self::Entity as EntityTrait>::Column, v: Value);
fn unset(&mut self, c: <Self::Entity as EntityTrait>::Column);
fn is_unset(&self, c: <Self::Entity as EntityTrait>::Column) -> bool;
fn default() -> Self;
fn insert<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>>
where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn update<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn save<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>>
where
Self: ActiveModelBehavior,
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
fn delete<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>>
where
Self: ActiveModelBehavior,
'life0: 'async_trait,
Self: Send + 'async_trait,
{ ... }
}
Associated Types
type Entity: EntityTrait
Required methods
fn take(
&mut self,
c: <Self::Entity as EntityTrait>::Column
) -> ActiveValue<Value>
fn get(&self, c: <Self::Entity as EntityTrait>::Column) -> ActiveValue<Value>
fn unset(&mut self, c: <Self::Entity as EntityTrait>::Column)
Provided methods
fn insert<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>> where
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn update<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Send + 'async_trait,
fn save<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>> where
Self: ActiveModelBehavior,
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn save<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<Self, DbErr>> + Send + 'async_trait>> where
Self: ActiveModelBehavior,
<Self::Entity as EntityTrait>::Model: IntoActiveModel<Self>,
'life0: 'async_trait,
Self: Send + 'async_trait,
Insert the model if primary key is unset, update otherwise. Only works if the entity has auto increment primary key.
fn delete<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>> where
Self: ActiveModelBehavior,
'life0: 'async_trait,
Self: Send + 'async_trait,
fn delete<'life0, 'async_trait>(
self,
db: &'life0 DatabaseConnection
) -> Pin<Box<dyn Future<Output = Result<DeleteResult, DbErr>> + Send + 'async_trait>> where
Self: ActiveModelBehavior,
'life0: 'async_trait,
Self: Send + 'async_trait,
Delete an active model by its primary key