Skip to main content

ExprMethods

Trait ExprMethods 

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

Source

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

Source

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

Source

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

Source

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

Source

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

a OR b — see and.

Source

fn like<Rhs: IntoExpr>( self, rhs: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Self::Sql: TextLike, Rhs::Sql: TextLike, Self::Req: Concat<Rhs::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::Item: IntoExpr<Req = Nil>, Self::Sql: Comparable<<I::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§