Skip to content

Commit

Permalink
Clarify behavior #1138
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Mar 10, 2023
1 parent da77eb0 commit d673f16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/entity/active_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,15 +611,15 @@ pub trait ActiveModelBehavior: ActiveModelTrait {
<Self as ActiveModelTrait>::default()
}

/// Will be called before saving
/// Will be called before `ActiveModel::insert`, `ActiveModel::update`, and `ActiveModel::save`
async fn before_save<C>(self, db: &C, insert: bool) -> Result<Self, DbErr>
where
C: ConnectionTrait,
{
Ok(self)
}

/// Will be called after saving
/// Will be called after `ActiveModel::insert`, `ActiveModel::update`, and `ActiveModel::save`
async fn after_save<C>(
model: <Self::Entity as EntityTrait>::Model,
db: &C,
Expand All @@ -631,15 +631,15 @@ pub trait ActiveModelBehavior: ActiveModelTrait {
Ok(model)
}

/// Will be called before deleting
/// Will be called before `ActiveModel::delete`
async fn before_delete<C>(self, db: &C) -> Result<Self, DbErr>
where
C: ConnectionTrait,
{
Ok(self)
}

/// Will be called after deleting
/// Will be called after `ActiveModel::delete`
async fn after_delete<C>(self, db: &C) -> Result<Self, DbErr>
where
C: ConnectionTrait,
Expand Down

0 comments on commit d673f16

Please sign in to comment.