pub enum Expr {
Show 14 variants
Column(ColumnRef),
Literal(Value),
BinaryOp {
left: Box<Expr>,
op: BinaryOp,
right: Box<Expr>,
},
UnaryOp {
op: UnaryOp,
expr: Box<Expr>,
},
Function {
name: String,
args: Vec<Expr>,
},
Aggregate {
func: AggregateFunc,
expr: Option<Box<Expr>>,
distinct: bool,
},
Between {
expr: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
},
NotBetween {
expr: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
},
In {
expr: Box<Expr>,
list: Vec<Expr>,
},
NotIn {
expr: Box<Expr>,
list: Vec<Expr>,
},
Like {
expr: Box<Expr>,
pattern: String,
},
NotLike {
expr: Box<Expr>,
pattern: String,
},
Match {
expr: Box<Expr>,
pattern: String,
},
NotMatch {
expr: Box<Expr>,
pattern: String,
},
}Expand description
Expression AST node.
Variants§
Column(ColumnRef)
Column reference.
Literal(Value)
Literal value.
BinaryOp
Binary operation.
UnaryOp
Unary operation.
Function
Function call.
Aggregate
Aggregate function.
Between
BETWEEN expression.
NotBetween
NOT BETWEEN expression.
In
IN expression.
NotIn
NOT IN expression.
Like
LIKE expression.
NotLike
NOT LIKE expression.
Match
MATCH (regex) expression.
NotMatch
NOT MATCH (regex) expression.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn column(
table: impl Into<String>,
column: impl Into<String>,
index: usize,
) -> Self
pub fn column( table: impl Into<String>, column: impl Into<String>, index: usize, ) -> Self
Creates a column reference expression.
Sourcepub fn is_not_null(expr: Expr) -> Self
pub fn is_not_null(expr: Expr) -> Self
Creates an IS NOT NULL expression.
Sourcepub fn count_star() -> Self
pub fn count_star() -> Self
Creates a COUNT(*) aggregate.
Sourcepub fn not_between(expr: Expr, low: Expr, high: Expr) -> Self
pub fn not_between(expr: Expr, low: Expr, high: Expr) -> Self
Creates a NOT BETWEEN expression.
Sourcepub fn not_in_list(expr: Expr, values: Vec<Value>) -> Self
pub fn not_in_list(expr: Expr, values: Vec<Value>) -> Self
Creates a NOT IN expression.
Sourcepub fn regex_match(expr: Expr, pattern: &str) -> Self
pub fn regex_match(expr: Expr, pattern: &str) -> Self
Creates a MATCH (regex) expression.
Sourcepub fn not_regex_match(expr: Expr, pattern: &str) -> Self
pub fn not_regex_match(expr: Expr, pattern: &str) -> Self
Creates a NOT MATCH (regex) expression.
Sourcepub fn jsonb_path_eq(expr: Expr, path: &str, value: Value) -> Self
pub fn jsonb_path_eq(expr: Expr, path: &str, value: Value) -> Self
Creates a JSONB path equality expression.
Sourcepub fn jsonb_contains(expr: Expr, path: &str) -> Self
pub fn jsonb_contains(expr: Expr, path: &str) -> Self
Creates a JSONB contains expression.
Sourcepub fn jsonb_exists(expr: Expr, path: &str) -> Self
pub fn jsonb_exists(expr: Expr, path: &str) -> Self
Creates a JSONB exists expression.
Sourcepub fn is_equi_join(&self) -> bool
pub fn is_equi_join(&self) -> bool
Checks if this is an equi-join condition (column = column).
Sourcepub fn is_range_join(&self) -> bool
pub fn is_range_join(&self) -> bool
Checks if this is a range join condition (>, <, >=, <=).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
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
Mutably borrows from an owned value. Read more