#[non_exhaustive]pub enum SimpleExpr {
Show 18 variants
Column(ColumnRef),
TableColumn(Arc<dyn Iden>, Arc<dyn Iden>),
Value(Value),
Unary(UnOper, Box<SimpleExpr>),
Binary(Box<SimpleExpr>, BinOper, Box<SimpleExpr>),
FunctionCall(Arc<dyn Iden>, Vec<SimpleExpr>),
SubQuery(Option<SubQueryOper>, Box<SelectStatement>),
Tuple(Vec<SimpleExpr>),
Custom(String),
CustomWithExpr(String, Vec<SimpleExpr>),
Constant(Keyword),
Asterisk,
Case(Box<CaseStatement>),
AsEnum(Arc<dyn Iden>, Box<SimpleExpr>),
ExprAlias(Box<SimpleExpr>, Arc<dyn Iden>),
Cast(Box<SimpleExpr>, Arc<dyn Iden>),
Window {
func: Box<SimpleExpr>,
window: WindowStatement,
},
WindowNamed {
func: Box<SimpleExpr>,
name: Arc<dyn Iden>,
},
}database and native only.Expand description
A simple SQL expression.
This enum represents the AST for SQL expressions. Each variant corresponds to a type of SQL expression that can appear in queries.
§Example
use reinhardt_query::SimpleExpr;
// Column reference
let col = SimpleExpr::Column(ColumnRef::column("name"));
// Value literal
let val = SimpleExpr::Value(Value::Int(Some(42)));
// Binary operation (column = 42)
let eq = SimpleExpr::Binary(
Box::new(col),
BinOper::Equal,
Box::new(val),
);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Column(ColumnRef)
A column reference (e.g., name, users.name, public.users.name)
TableColumn(Arc<dyn Iden>, Arc<dyn Iden>)
A table-qualified column (legacy format)
Value(Value)
A literal value (e.g., 42, 'hello', TRUE)
Unary(UnOper, Box<SimpleExpr>)
A unary operation (e.g., NOT x)
Binary(Box<SimpleExpr>, BinOper, Box<SimpleExpr>)
A binary operation (e.g., x = y, a AND b, x + y)
FunctionCall(Arc<dyn Iden>, Vec<SimpleExpr>)
A function call (e.g., MAX(x), LOWER(name))
SubQuery(Option<SubQueryOper>, Box<SelectStatement>)
A subquery (e.g., (SELECT ...))
The optional operator indicates how the subquery is used:
None: Standalone subquery (e.g., in FROM clause or SELECT list)Some(SubQueryOper): Subquery with operator (e.g., IN, EXISTS, ALL)
Tuple(Vec<SimpleExpr>)
A tuple of expressions (e.g., (1, 2, 3))
Custom(String)
A custom SQL expression (e.g., NOW())
§Security Warning
This variant embeds raw SQL directly into the query. Only use with trusted
input or static SQL strings. For dynamic values, use CustomWithExpr instead.
CustomWithExpr(String, Vec<SimpleExpr>)
A custom SQL expression with parameter placeholders
Constant(Keyword)
A constant (database-specific constant like TRUE, FALSE, NULL)
Asterisk
An asterisk (*)
Case(Box<CaseStatement>)
A CASE WHEN expression
AsEnum(Arc<dyn Iden>, Box<SimpleExpr>)
A PostgreSQL enum type cast (e.g., expr::type_name)
ExprAlias(Box<SimpleExpr>, Arc<dyn Iden>)
An aliased expression (e.g., expr AS alias_name)
Cast(Box<SimpleExpr>, Arc<dyn Iden>)
A CAST expression (e.g., CAST(x AS INTEGER))
Window
A window function with inline window specification
Represents expressions like:
ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary DESC)Fields
func: Box<SimpleExpr>The function expression
window: WindowStatementThe window specification
WindowNamed
A window function with named window reference
Represents expressions like:
ROW_NUMBER() OVER window_namewhere window_name is defined in the WINDOW clause.
Implementations§
Source§impl SimpleExpr
impl SimpleExpr
Sourcepub fn binary(self, op: BinOper, right: SimpleExpr) -> SimpleExpr
pub fn binary(self, op: BinOper, right: SimpleExpr) -> SimpleExpr
Create a binary operation expression.
Trait Implementations§
Source§impl Clone for SimpleExpr
impl Clone for SimpleExpr
Source§fn clone(&self) -> SimpleExpr
fn clone(&self) -> SimpleExpr
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SimpleExpr
impl Debug for SimpleExpr
Source§impl ExprTrait for SimpleExpr
impl ExprTrait for SimpleExpr
Source§fn into_simple_expr(self) -> SimpleExpr
fn into_simple_expr(self) -> SimpleExpr
Source§fn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn eq<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
=). Read moreSource§fn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn ne<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
<>).Source§fn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn lt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
<).Source§fn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn lte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
<=).Source§fn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn gt<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
>).Source§fn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn gte<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
>=).Source§fn is_null(self) -> SimpleExpr
fn is_null(self) -> SimpleExpr
Source§fn is_not_null(self) -> SimpleExpr
fn is_not_null(self) -> SimpleExpr
Source§fn between<A, B>(self, a: A, b: B) -> SimpleExpr
fn between<A, B>(self, a: A, b: B) -> SimpleExpr
Source§fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
fn not_between<A, B>(self, a: A, b: B) -> SimpleExpr
Source§fn is_in<I, V>(self, values: I) -> SimpleExpr
fn is_in<I, V>(self, values: I) -> SimpleExpr
Source§fn is_not_in<I, V>(self, values: I) -> SimpleExpr
fn is_not_in<I, V>(self, values: I) -> SimpleExpr
Source§fn like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Source§fn not_like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn not_like<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Source§fn ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Source§fn not_ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn not_ilike<V>(self, pattern: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
Source§fn starts_with<S>(self, prefix: S) -> SimpleExpr
fn starts_with<S>(self, prefix: S) -> SimpleExpr
Source§fn ends_with<S>(self, suffix: S) -> SimpleExpr
fn ends_with<S>(self, suffix: S) -> SimpleExpr
Source§fn contains<S>(self, substring: S) -> SimpleExpr
fn contains<S>(self, substring: S) -> SimpleExpr
Source§fn and<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
fn and<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
Source§fn or<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
fn or<E>(self, other: E) -> SimpleExprwhere
E: Into<SimpleExpr>,
Source§fn not(self) -> SimpleExpr
fn not(self) -> SimpleExpr
Source§fn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn add<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
+).Source§fn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn sub<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
-).Source§fn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn mul<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
*).Source§fn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn div<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
/).Source§fn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn modulo<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
%).Source§fn bit_and<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn bit_and<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
&).Source§fn bit_or<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn bit_or<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
|).Source§fn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn left_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
<<).Source§fn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
fn right_shift<V>(self, v: V) -> SimpleExprwhere
V: Into<SimpleExpr>,
>>).Source§fn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
fn as_enum<T>(self, type_name: T) -> SimpleExprwhere
T: IntoIden,
Source§impl From<&str> for SimpleExpr
impl From<&str> for SimpleExpr
Source§fn from(s: &str) -> SimpleExpr
fn from(s: &str) -> SimpleExpr
Source§impl From<CaseStatement> for SimpleExpr
impl From<CaseStatement> for SimpleExpr
Source§fn from(case: CaseStatement) -> SimpleExpr
fn from(case: CaseStatement) -> SimpleExpr
Source§impl From<ColumnRef> for SimpleExpr
impl From<ColumnRef> for SimpleExpr
Source§fn from(c: ColumnRef) -> SimpleExpr
fn from(c: ColumnRef) -> SimpleExpr
Source§impl From<Expr> for SimpleExpr
impl From<Expr> for SimpleExpr
Source§fn from(e: Expr) -> SimpleExpr
fn from(e: Expr) -> SimpleExpr
Source§impl From<Keyword> for SimpleExpr
impl From<Keyword> for SimpleExpr
Source§fn from(k: Keyword) -> SimpleExpr
fn from(k: Keyword) -> SimpleExpr
Source§impl From<SimpleExpr> for Expr
impl From<SimpleExpr> for Expr
Source§fn from(e: SimpleExpr) -> Expr
fn from(e: SimpleExpr) -> Expr
Source§impl From<String> for SimpleExpr
impl From<String> for SimpleExpr
Source§fn from(s: String) -> SimpleExpr
fn from(s: String) -> SimpleExpr
Source§impl From<Value> for SimpleExpr
impl From<Value> for SimpleExpr
Source§fn from(v: Value) -> SimpleExpr
fn from(v: Value) -> SimpleExpr
Source§impl From<bool> for SimpleExpr
impl From<bool> for SimpleExpr
Source§fn from(b: bool) -> SimpleExpr
fn from(b: bool) -> SimpleExpr
Source§impl From<f32> for SimpleExpr
impl From<f32> for SimpleExpr
Source§fn from(f: f32) -> SimpleExpr
fn from(f: f32) -> SimpleExpr
Source§impl From<f64> for SimpleExpr
impl From<f64> for SimpleExpr
Source§fn from(f: f64) -> SimpleExpr
fn from(f: f64) -> SimpleExpr
Source§impl From<i32> for SimpleExpr
impl From<i32> for SimpleExpr
Source§fn from(i: i32) -> SimpleExpr
fn from(i: i32) -> SimpleExpr
Source§impl From<i64> for SimpleExpr
impl From<i64> for SimpleExpr
Source§fn from(i: i64) -> SimpleExpr
fn from(i: i64) -> SimpleExpr
Source§impl IntoCondition for SimpleExpr
impl IntoCondition for SimpleExpr
Source§fn into_condition_expression(self) -> ConditionExpression
fn into_condition_expression(self) -> ConditionExpression
Source§fn into_condition(self) -> Conditionwhere
Self: Sized,
fn into_condition(self) -> Conditionwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for SimpleExpr
impl !RefUnwindSafe for SimpleExpr
impl Send for SimpleExpr
impl Sync for SimpleExpr
impl Unpin for SimpleExpr
impl UnsafeUnpin for SimpleExpr
impl !UnwindSafe for SimpleExpr
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<E> ServerFnErrorAssertions<E> for Ewhere
E: Debug,
impl<E> ServerFnErrorAssertions<E> for Ewhere
E: Debug,
Source§fn should_contain_message(&self, expected: &str)where
E: Display,
fn should_contain_message(&self, expected: &str)where
E: Display,
Source§fn should_have_message(&self, expected: &str)where
E: Display,
fn should_have_message(&self, expected: &str)where
E: Display,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.