Skip to main content

soft_delete

Function soft_delete 

Source
pub async fn soft_delete(
    pool: &PgPool,
    model: &'static ModelSchema,
    pk_column: &'static str,
    pk_value: SqlValue,
) -> Result<u64, SoftDeleteError>
Expand description

Set model’s soft-delete column to NOW() for the row whose pk equals pk_value. Returns the number of rows affected.

§Errors

SoftDeleteError::NotSoftDeleteEnabled when the model has no #[rustango(soft_delete)] field. SoftDeleteError::Exec for the underlying sqlx error.