Trait diesel::prelude::FilterDsl [] [src]

pub trait FilterDsl<Predicate>: AsQuery {
    type Output: AsQuery<SqlType=Self::SqlType>;
    fn filter(self, predicate: Predicate) -> Self::Output;
}

Adds to the WHERE clause of a query. If there is already a WHERE clause, the result will be old AND new. This is automatically implemented for the various query builder types.

Example:

let seans_id = users.filter(name.eq("Sean")).select(id)
    .first(&connection);
assert_eq!(Ok(1), seans_id);
let tess_id = users.filter(name.eq("Tess")).select(id)
    .first(&connection);
assert_eq!(Ok(2), tess_id);

Associated Types

Required Methods

Implementors