pub struct Expr<Req, S: SqlType> { /* private fields */ }Expand description
A typed SQL expression. Req is the (possibly empty) flat list of
tables this expression references — see the module docs and
scope::Superset for how that’s checked against a query’s actual scope
at the point the expression is used, not at the point it’s built. This
is what lets orders::user_id.eq(users::id) be a plain, portable value
with no dependency on which query it’ll eventually be used in.
Implementations§
Trait Implementations§
Source§impl<Req, S: SqlType> IntoExpr for Expr<Req, S>
impl<Req, S: SqlType> IntoExpr for Expr<Req, S>
Source§type Sql = S
type Sql = S
Comparable/AssignsTo rather than as
an inference failure on a type nobody wrote.type Req = Req
fn into_expr(self) -> Expr<Req, S>
Source§impl IntoRowCount for Expr<Nil, Integer>
A prepare!{} placeholder, or any other scope-free Expr of an integer type:
bound rather than written, so one prepared query serves every page. Only
the two integer types — a page is a number.
impl IntoRowCount for Expr<Nil, Integer>
A prepare!{} placeholder, or any other scope-free Expr of an integer type:
bound rather than written, so one prepared query serves every page. Only
the two integer types — a page is a number.
fn into_row_count(self) -> RowCount
Source§impl IntoRowCount for Expr<Nil, BigInt>
impl IntoRowCount for Expr<Nil, BigInt>
fn into_row_count(self) -> RowCount
Source§impl<Req, S: BoolLike> Not for Expr<Req, S>
!condition, not condition.not(): the standard Not trait reads more
naturally at call sites than a same-named inherent method. Implemented
for all three spellings .filter takes, each keeping its own type —
NOT of a Nullable<Bool> is still nullable, and a sql! fragment
stays the same fragment.
impl<Req, S: BoolLike> Not for Expr<Req, S>
!condition, not condition.not(): the standard Not trait reads more
naturally at call sites than a same-named inherent method. Implemented
for all three spellings .filter takes, each keeping its own type —
NOT of a Nullable<Bool> is still nullable, and a sql! fragment
stays the same fragment.
Auto Trait Implementations§
impl<Req, S> Freeze for Expr<Req, S>
impl<Req, S> RefUnwindSafe for Expr<Req, S>
impl<Req, S> Send for Expr<Req, S>
impl<Req, S> Sync for Expr<Req, S>
impl<Req, S> Unpin for Expr<Req, S>
impl<Req, S> UnsafeUnpin for Expr<Req, S>
impl<Req, S> UnwindSafe for Expr<Req, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D, Scope, Req, Idxs, T> Condition<D, Scope, Idxs> for T
impl<D, Scope, Req, Idxs, T> Condition<D, Scope, Idxs> for T
fn into_predicate(self) -> Predicate<D, Scope>
Source§impl<T> ExprMethods for Twhere
T: IntoExpr,
impl<T> ExprMethods for Twhere
T: IntoExpr,
fn eq<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn ne<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn lt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn lte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn gt<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn gte<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
Source§fn is_null(self) -> Expr<Self::Req, Bool>
fn is_null(self) -> Expr<Self::Req, Bool>
x IS NULL. Not expressible as .eq(..): comparing to NULL with =
yields NULL, never true, so the two are different questions.fn is_not_null(self) -> Expr<Self::Req, Bool>
Source§fn and<Rhs: IntoExpr>(
self,
rhs: Rhs,
) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn and<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
a AND b. The boolean requirement is on the method rather than on
the receiver’s type, so every spelling a condition has — a
comparison, a sql! fragment, a Nullable<Bool> column — combines
with every other, the way .filter accepts them all.Source§fn or<Rhs: IntoExpr>(
self,
rhs: Rhs,
) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
fn or<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
a OR b — see and.