pub enum Expr {
Column(String),
Literal(Literal),
BinaryOp {
left: Box<Expr>,
op: BinaryOperator,
right: Box<Expr>,
},
UnaryOp {
op: UnaryOperator,
expr: Box<Expr>,
},
Function {
name: String,
args: Vec<Expr>,
},
Case {
when_then: Vec<(Expr, Expr)>,
else_expr: Option<Box<Expr>>,
},
Cast {
expr: Box<Expr>,
data_type: ExprDataType,
},
Coalesce {
exprs: Vec<Expr>,
},
}Expand description
Represents an expression that can be used in a distributed computation
Variants§
Column(String)
Column reference
Literal(Literal)
Literal value
BinaryOp
Binary operation
UnaryOp
Unary operation
Function
Function call
Case
Case statement
Fields
Cast
CAST expression
Coalesce
COALESCE expression
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn binary(left: Expr, op: BinaryOperator, right: Expr) -> Self
pub fn binary(left: Expr, op: BinaryOperator, right: Expr) -> Self
Creates a binary operation
Sourcepub fn unary(op: UnaryOperator, expr: Expr) -> Self
pub fn unary(op: UnaryOperator, expr: Expr) -> Self
Creates a unary operation
Sourcepub fn case(when_then: Vec<(Expr, Expr)>, else_expr: Option<Expr>) -> Self
pub fn case(when_then: Vec<(Expr, Expr)>, else_expr: Option<Expr>) -> Self
Creates a CASE expression
Sourcepub fn cast(expr: Expr, data_type: ExprDataType) -> Self
pub fn cast(expr: Expr, data_type: ExprDataType) -> Self
Creates a CAST expression
Sourcepub fn lte(self, other: Expr) -> Self
pub fn lte(self, other: Expr) -> Self
Checks if this expression is less than or equal to another
Sourcepub fn gte(self, other: Expr) -> Self
pub fn gte(self, other: Expr) -> Self
Checks if this expression is greater than or equal to another
Sourcepub fn is_not_null(self) -> Self
pub fn is_not_null(self) -> Self
Checks if this expression is NOT NULL
Sourcepub fn to_boolean(self) -> Self
pub fn to_boolean(self) -> Self
Casts this expression to boolean
Sourcepub fn to_integer(self) -> Self
pub fn to_integer(self) -> Self
Casts this expression to integer
Sourcepub fn to_timestamp(self) -> Self
pub fn to_timestamp(self) -> Self
Casts this expression to timestamp
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DisplayExt for Twhere
T: Display,
impl<T> DisplayExt for Twhere
T: Display,
Source§fn display_with_format(&self, format: &str) -> String
fn display_with_format(&self, format: &str) -> String
Displays the value with a specified format
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>
Converts
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>
Converts
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 more