Skip to main content

TrashedQuery

Trait TrashedQuery 

Source
pub trait TrashedQuery {
    // Required methods
    fn without_trashed(self) -> Self;
    fn only_trashed(self) -> Self;
}
Expand description

Trash filters for any query on a SoftDelete entity.

use sea_orm::{ColumnTrait, DatabaseConnection, DbErr, EntityTrait, QueryFilter};
use sea_orm_soft_delete::TrashedQuery;

async fn example(db: &DatabaseConnection) -> Result<(), DbErr> {
    let posts = posts::Entity::find()
        .filter(posts::Column::CategoryId.eq(1))
        .without_trashed()
        .all(db)
        .await?;
    Ok(())
}

There is no with_trashed(): a plain query already includes trashed rows.

Required Methods§

Source

fn without_trashed(self) -> Self

Keeps only rows that are not in the trash.

Source

fn only_trashed(self) -> Self

Keeps only rows that are in the trash.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<E: SoftDelete> TrashedQuery for Select<E>

Source§

fn without_trashed(self) -> Self

Source§

fn only_trashed(self) -> Self

Implementors§