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
Required Methods
fn filter(self, predicate: Predicate) -> Self::Output
Implementors
impl<T, Predicate> FilterDsl<Predicate> for T where Predicate: Expression<SqlType=Bool> + NonAggregate, FilteredQuerySource<T, Predicate>: AsQuery, T: NotFiltered