Skip to main content

ExprMethods

Trait ExprMethods 

Source
pub trait ExprMethods: Sized + IntoExpr {
    // Provided methods
    fn eq<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn ne<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn lt<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn lte<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn gt<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn gte<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn is_null(self) -> Expr<Self::Req, Bool> { ... }
    fn is_not_null(self) -> Expr<Self::Req, Bool> { ... }
    fn and<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: BoolLike,
             <Rhs as IntoExpr>::Sql: BoolLike,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn or<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: BoolLike,
             <Rhs as IntoExpr>::Sql: BoolLike,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn like<Rhs>(
        self,
        rhs: Rhs,
    ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
       where Rhs: IntoExpr,
             Self::Sql: TextLike,
             <Rhs as IntoExpr>::Sql: TextLike,
             Self::Req: Concat<<Rhs as IntoExpr>::Req> { ... }
    fn is_in<I>(self, values: I) -> Expr<Self::Req, Bool>
       where I: IntoIterator,
             <I as IntoIterator>::Item: IntoExpr<Req = Nil>,
             Self::Sql: Comparable<<<I as IntoIterator>::Item as IntoExpr>::Sql> { ... }
}
Expand description

Comparison/boolean-combinator methods, blanket-implemented for anything convertible to a typed expression (columns, literals, and Expr itself). Kept separate from IntoExpr so one blanket impl can serve all three.

Provided Methods§

Source

fn eq<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

fn ne<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

fn lt<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

fn lte<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

fn gt<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

fn gte<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: Comparable<<Rhs as IntoExpr>::Sql>, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

Source

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.

Source

fn is_not_null(self) -> Expr<Self::Req, Bool>

Source

fn and<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: BoolLike, <Rhs as IntoExpr>::Sql: BoolLike, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

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>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: BoolLike, <Rhs as IntoExpr>::Sql: BoolLike, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

a OR b — see and.

Source

fn like<Rhs>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<<Rhs as IntoExpr>::Req>>::Output, Bool>
where Rhs: IntoExpr, Self::Sql: TextLike, <Rhs as IntoExpr>::Sql: TextLike, Self::Req: Concat<<Rhs as IntoExpr>::Req>,

x LIKE 'pattern'. The text requirement is on the method rather than on a trait of its own, so a non-text operand reports TextLike instead of a missing method.

Source

fn is_in<I>(self, values: I) -> Expr<Self::Req, Bool>
where I: IntoIterator, <I as IntoIterator>::Item: IntoExpr<Req = Nil>, Self::Sql: Comparable<<<I as IntoIterator>::Item as IntoExpr>::Sql>,

x IN (a, b, ..) over a runtime-length list of literals, each bound as its own parameter. An empty list renders FALSE.

Known limitation: the list holds values, not expressions — a column reference on the right needs the table it belongs to folded into Req, which is the same design sql!{} covers today.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> ExprMethods for T
where T: IntoExpr,