pub trait ExprTrait: Sized {
Show 34 methods
// Required method
fn into_simple_expr(self) -> SimpleExpr;
// Provided methods
fn eq<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn ne<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn lt<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn lte<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn gt<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn gte<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn is_null(self) -> SimpleExpr { ... }
fn is_not_null(self) -> SimpleExpr { ... }
fn between<A, B>(self, a: A, b: B) -> SimpleExpr
where A: Into<SimpleExpr>,
B: Into<SimpleExpr> { ... }
fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
where A: Into<SimpleExpr>,
B: Into<SimpleExpr> { ... }
fn is_in<I, V>(self, values: I) -> SimpleExpr
where I: IntoIterator<Item = V>,
V: Into<SimpleExpr> { ... }
fn is_not_in<I, V>(self, values: I) -> SimpleExpr
where I: IntoIterator<Item = V>,
V: Into<SimpleExpr> { ... }
fn like<V>(self, pattern: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn not_like<V>(self, pattern: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn ilike<V>(self, pattern: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn not_ilike<V>(self, pattern: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn starts_with<S>(self, prefix: S) -> SimpleExpr
where S: Into<String> { ... }
fn ends_with<S>(self, suffix: S) -> SimpleExpr
where S: Into<String> { ... }
fn contains<S>(self, substring: S) -> SimpleExpr
where S: Into<String> { ... }
fn and<E>(self, other: E) -> SimpleExpr
where E: Into<SimpleExpr> { ... }
fn or<E>(self, other: E) -> SimpleExpr
where E: Into<SimpleExpr> { ... }
fn not(self) -> SimpleExpr { ... }
fn add<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn sub<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn mul<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn div<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn modulo<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn bit_and<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn bit_or<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn left_shift<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn right_shift<V>(self, v: V) -> SimpleExpr
where V: Into<SimpleExpr> { ... }
fn cast_as<T>(self, type_name: T) -> SimpleExpr
where T: IntoIden { ... }
fn as_enum<T>(self, type_name: T) -> SimpleExpr
where T: IntoIden { ... }
}Expand description
Trait for expression operations.
This trait provides methods for building complex expressions through
operator chaining. It is implemented for Expr and SimpleExpr.
§Example
use reinhardt_query::{Expr, ExprTrait};
// Comparison
let expr = Expr::col("age").gte(18);
// Logical operations
let expr = Expr::col("active").eq(true).and(Expr::col("verified").eq(true));
// Arithmetic
let expr = Expr::col("price").mul(Expr::col("quantity"));Required Methods§
Sourcefn into_simple_expr(self) -> SimpleExpr
fn into_simple_expr(self) -> SimpleExpr
Build the final SimpleExpr.
Provided Methods§
Sourcefn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Sourcefn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Not equal (<>).
Sourcefn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Less than (<).
Sourcefn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Less than or equal (<=).
Sourcefn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Greater than (>).
Sourcefn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Greater than or equal (>=).
Sourcefn is_null(self) -> SimpleExpr
fn is_null(self) -> SimpleExpr
IS NULL.
Sourcefn is_not_null(self) -> SimpleExpr
fn is_not_null(self) -> SimpleExpr
IS NOT NULL.
Sourcefn between<A, B>(self, a: A, b: B) -> SimpleExpr
fn between<A, B>(self, a: A, b: B) -> SimpleExpr
Sourcefn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
NOT BETWEEN.
Sourcefn is_in<I, V>(self, values: I) -> SimpleExpr
fn is_in<I, V>(self, values: I) -> SimpleExpr
Sourcefn is_not_in<I, V>(self, values: I) -> SimpleExpr
fn is_not_in<I, V>(self, values: I) -> SimpleExpr
NOT IN.
Returns TRUE when the iterator is empty, since x NOT IN () is invalid SQL
and logically equivalent to TRUE.
Sourcefn like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Sourcefn not_like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn not_like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
NOT LIKE.
Sourcefn ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
ILIKE (case-insensitive LIKE, PostgreSQL).
Sourcefn not_ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn not_ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
NOT ILIKE (PostgreSQL).
Sourcefn starts_with<S>(self, prefix: S) -> SimpleExpr
fn starts_with<S>(self, prefix: S) -> SimpleExpr
Helper for LIKE with prefix wildcard.
SQL wildcard characters (%, _) and the escape character (\) in
user input are escaped before constructing the pattern. The generated
SQL includes an explicit ESCAPE '\' clause so that the backslash
escaping is portable across all backends (including SQLite, which does
not treat \ as an escape character by default).
Sourcefn ends_with<S>(self, suffix: S) -> SimpleExpr
fn ends_with<S>(self, suffix: S) -> SimpleExpr
Helper for LIKE with suffix wildcard.
SQL wildcard characters (%, _) and the escape character (\) in
user input are escaped before constructing the pattern. The generated
SQL includes an explicit ESCAPE '\' clause for cross-backend
portability.
Sourcefn contains<S>(self, substring: S) -> SimpleExpr
fn contains<S>(self, substring: S) -> SimpleExpr
Helper for LIKE with both wildcards.
SQL wildcard characters (%, _) and the escape character (\) in
user input are escaped before constructing the pattern. The generated
SQL includes an explicit ESCAPE '\' clause for cross-backend
portability.
Sourcefn and<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
fn and<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
AND.
Sourcefn or<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
fn or<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
OR.
Sourcefn not(self) -> SimpleExpr
fn not(self) -> SimpleExpr
NOT (unary).
Sourcefn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Addition (+).
Sourcefn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Subtraction (-).
Sourcefn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Multiplication (*).
Sourcefn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Division (/).
Sourcefn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Modulo (%).
Sourcefn bit_and<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn bit_and<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Bitwise AND (&).
Sourcefn bit_or<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn bit_or<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Bitwise OR (|).
Sourcefn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Left shift (<<).
Sourcefn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Right shift (>>).
Sourcefn cast_as<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
fn cast_as<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
Sourcefn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
fn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
AS ENUM expression (PostgreSQL).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".