pub enum Expr {
Show 40 variants
ColumnRef {
span: Span,
column: ColumnRef,
},
IsNull {
span: Span,
expr: Box<Expr>,
not: bool,
},
IsDistinctFrom {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
not: bool,
},
InList {
span: Span,
expr: Box<Expr>,
list: Vec<Expr>,
not: bool,
},
InSubquery {
span: Span,
expr: Box<Expr>,
subquery: Box<Query>,
not: bool,
},
LikeSubquery {
span: Span,
expr: Box<Expr>,
subquery: Box<Query>,
modifier: SubqueryModifier,
escape: Option<String>,
},
LikeAnyWithEscape {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
escape: String,
},
LikeWithEscape {
span: Span,
left: Box<Expr>,
right: Box<Expr>,
is_not: bool,
escape: String,
},
Between {
span: Span,
expr: Box<Expr>,
low: Box<Expr>,
high: Box<Expr>,
not: bool,
},
BinaryOp {
span: Span,
op: BinaryOperator,
left: Box<Expr>,
right: Box<Expr>,
},
JsonOp {
span: Span,
op: JsonOperator,
left: Box<Expr>,
right: Box<Expr>,
},
UnaryOp {
span: Span,
op: UnaryOperator,
expr: Box<Expr>,
},
Cast {
span: Span,
expr: Box<Expr>,
target_type: TypeName,
pg_style: bool,
},
TryCast {
span: Span,
expr: Box<Expr>,
target_type: TypeName,
},
Extract {
span: Span,
kind: IntervalKind,
expr: Box<Expr>,
},
DatePart {
span: Span,
kind: IntervalKind,
expr: Box<Expr>,
},
Position {
span: Span,
substr_expr: Box<Expr>,
str_expr: Box<Expr>,
},
Substring {
span: Span,
expr: Box<Expr>,
substring_from: Box<Expr>,
substring_for: Option<Box<Expr>>,
},
Trim {
span: Span,
expr: Box<Expr>,
trim_where: Option<(TrimWhere, Box<Expr>)>,
},
Literal {
span: Span,
value: Literal,
},
CountAll {
span: Span,
qualified: Vec<Indirection>,
window: Option<Window>,
},
Tuple {
span: Span,
exprs: Vec<Expr>,
},
FunctionCall {
span: Span,
func: FunctionCall,
},
Case {
span: Span,
operand: Option<Box<Expr>>,
conditions: Vec<Expr>,
results: Vec<Expr>,
else_result: Option<Box<Expr>>,
},
Exists {
span: Span,
not: bool,
subquery: Box<Query>,
},
Subquery {
span: Span,
modifier: Option<SubqueryModifier>,
subquery: Box<Query>,
},
MapAccess {
span: Span,
expr: Box<Expr>,
accessor: MapAccessor,
},
Array {
span: Span,
exprs: Vec<Expr>,
},
Map {
span: Span,
kvs: Vec<(Literal, Expr)>,
},
Interval {
span: Span,
expr: Box<Expr>,
unit: IntervalKind,
},
DateAdd {
span: Span,
unit: IntervalKind,
interval: Box<Expr>,
date: Box<Expr>,
},
DateDiff {
span: Span,
unit: IntervalKind,
date_start: Box<Expr>,
date_end: Box<Expr>,
},
DateBetween {
span: Span,
unit: IntervalKind,
date_start: Box<Expr>,
date_end: Box<Expr>,
},
DateSub {
span: Span,
unit: IntervalKind,
interval: Box<Expr>,
date: Box<Expr>,
},
DateTrunc {
span: Span,
unit: IntervalKind,
date: Box<Expr>,
},
LastDay {
span: Span,
unit: IntervalKind,
date: Box<Expr>,
},
PreviousDay {
span: Span,
unit: Weekday,
date: Box<Expr>,
},
NextDay {
span: Span,
unit: Weekday,
date: Box<Expr>,
},
Hole {
span: Span,
name: String,
},
Placeholder {
span: Span,
},
}Variants§
ColumnRef
Column reference, with indirection like table.column
IsNull
IS [ NOT ] NULL expression
IsDistinctFrom
IS [NOT] DISTINCT expression
InList
[ NOT ] IN (expr, ...)
InSubquery
[ NOT ] IN (SELECT ...)
LikeSubquery
LIKE (SELECT ...) [ESCAPE '<escape>']
Fields
modifier: SubqueryModifierLikeAnyWithEscape
<left> LIKE ANY <right> ESCAPE '<escape>'
LikeWithEscape
<left> [NOT] LIKE <right> ESCAPE '<escape>'
Between
BETWEEN ... AND ...
BinaryOp
Binary operation
JsonOp
JSON operation
UnaryOp
Unary operation
Cast
CAST expression, like CAST(expr AS target_type)
TryCast
TRY_CAST expression`
Extract
EXTRACT(IntervalKind FROM
DatePart
DATE_PART(IntervalKind,
Position
POSITION(
Substring
SUBSTRING(
Trim
TRIM([[BOTH | LEADING | TRAILING]
Literal
A literal value, such as string, number, date or NULL
CountAll
COUNT(*) expression
Tuple
(foo, bar)
FunctionCall
Scalar/Agg/Window function call
Case
CASE ... WHEN ... ELSE ... expression
Fields
Exists
EXISTS expression
Subquery
Scalar/ANY/ALL/SOME subquery
MapAccess
Access elements of Array, Map and Variant by index or key, like arr[0], or obj:k1
Array
The Array expr
Map
The Map expr
Interval
The Interval 1 DAY expr
DateAdd
DateDiff
DateBetween
DateSub
DateTrunc
LastDay
PreviousDay
NextDay
Hole
Placeholder
Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);