pub trait ExprExt<'a, V: SQLParam>: Expr<'a, V> + Sized {
Show 14 methods
// Provided methods
fn eq<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn ne<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn gt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn ge<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn lt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn le<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Textual,
R::SQLType: Textual { ... }
fn not_like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where R: Expr<'a, V>,
Self::SQLType: Textual,
R::SQLType: Textual { ... }
fn is_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar> { ... }
fn is_not_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar> { ... }
fn between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType> { ... }
fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType> { ... }
fn in_array<I, R>(self, values: I) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
fn not_in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
where I: IntoIterator<Item = R>,
R: Expr<'a, V>,
Self::SQLType: Compatible<R::SQLType> { ... }
}Expand description
Extension trait providing method-based comparisons for any Expr type.
This trait is blanket-implemented for all types implementing Expr,
allowing method syntax on columns, literals, and expressions:
// Works on columns directly
users.id.eq(42)
users.age.gt(18)
// Chain with operators
users.id.eq(42) & users.age.gt(18)Provided Methods§
Sourcefn eq<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn eq<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Equality comparison (=).
users.id.eq(42) // "users"."id" = 42Sourcefn ne<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn ne<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Inequality comparison (<>).
users.id.ne(42) // "users"."id" <> 42Sourcefn gt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn gt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Greater-than comparison (>).
users.age.gt(18) // "users"."age" > 18Sourcefn ge<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn ge<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Greater-than-or-equal comparison (>=).
users.age.ge(18) // "users"."age" >= 18Sourcefn lt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn lt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Less-than comparison (<).
users.age.lt(65) // "users"."age" < 65Sourcefn le<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn le<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Less-than-or-equal comparison (<=).
users.age.le(65) // "users"."age" <= 65Sourcefn like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
LIKE pattern matching.
users.name.like("%Alice%") // "users"."name" LIKE '%Alice%'Sourcefn not_like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn not_like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
NOT LIKE pattern matching.
users.name.not_like("%Bot%") // "users"."name" NOT LIKE '%Bot%'Sourcefn is_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn is_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
IS NULL check.
users.deleted_at.is_null() // "users"."deleted_at" IS NULLSourcefn is_not_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn is_not_null(self) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
IS NOT NULL check.
users.email.is_not_null() // "users"."email" IS NOT NULLSourcefn between<L, H>(self, low: L, high: H) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
fn between<L, H>(self, low: L, high: H) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
BETWEEN comparison.
Checks if the value is between low and high (inclusive).
users.age.between(18, 65) // ("users"."age" BETWEEN 18 AND 65)Sourcefn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
NOT BETWEEN comparison.
Checks if the value is NOT between low and high.
users.age.not_between(0, 17) // ("users"."age" NOT BETWEEN 0 AND 17)Sourcefn in_array<I, R>(self, values: I) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn in_array<I, R>(self, values: I) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
IN array check.
Checks if the value is in the provided array.
users.role.in_array([Role::Admin, Role::Moderator])
// "users"."role" IN ('admin', 'moderator')Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.