Skip to main content

ExprMethods

Trait ExprMethods 

Source
pub trait ExprMethods: IntoExpr + Sized {
Show 13 methods // 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> { ... } fn eq_any<Rhs: IntoExpr>( self, array: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool> where Rhs::Sql: ArrayOf<Self::Sql>, Self::Req: Concat<Rhs::Req> { ... }
}
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.

Source

fn eq_any<Rhs: IntoExpr>( self, array: Rhs, ) -> Expr<<Self::Req as Concat<Rhs::Req>>::Output, Bool>
where Rhs::Sql: ArrayOf<Self::Sql>, Self::Req: Concat<Rhs::Req>,

x = ANY(<array>): is this value one of the elements of that array column. The mirror of is_in, which asks the same question of a list the statement writes out: here the list is one value the database unnests, so the array can be a column.

! it for “not one of them”: that is NOT (x = ANY(a)), which SQL also spells x <> ALL(a). It is not x <> ANY(a), which is true as soon as some element differs.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§