Trait diesel:: prelude:: FilterDsl
[−]
[src]
pub trait FilterDsl<Predicate: Expression<SqlType=Bool> + NonAggregate> { type Output: AsQuery; 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
type Output: AsQuery
Required Methods
Implementors
impl<'a, ST, QS, DB, Predicate> FilterDsl<Predicate> for BoxedSelectStatement<'a, ST, QS, DB> where DB: Backend + HasSqlType<ST> + 'a, Predicate: SelectableExpression<QS, SqlType=Bool> + NonAggregate, Predicate: QueryFragment<DB> + 'a