pub enum ExprSet {
Select(Box<Select>),
SetOp(ExprSetOp),
Update(Box<Update>),
Values(Values),
Insert(Box<Insert>),
}Expand description
A set of rows produced by a query, set operation, or explicit values.
Represents the different ways to produce a collection of rows in SQL.
§Examples
SELECT * FROM users // ExprSet::Select
SELECT ... UNION SELECT ... // ExprSet::SetOp
VALUES (1, 'a'), (2, 'b') // ExprSet::ValuesVariants§
Select(Box<Select>)
A select query, possibly with a filter.
SetOp(ExprSetOp)
A set operation (union, intersection, …) on two queries.
Update(Box<Update>)
An update expression.
Values(Values)
Explicitly listed values (as expressions).
Insert(Box<Insert>)
An insert statement (used for UNION-style batch inserts)
Implementations§
Source§impl ExprSet
impl ExprSet
Sourcepub fn values(values: impl Into<Values>) -> ExprSet
pub fn values(values: impl Into<Values>) -> ExprSet
Creates an ExprSet::Values from explicit values.
Sourcepub fn is_values(&self) -> bool
pub fn is_values(&self) -> bool
Returns true if this is an ExprSet::Values variant.
§Examples
let values = ExprSet::values(Values::default());
assert!(values.is_values());
let select = ExprSet::from(toasty_core::schema::db::TableId(0));
assert!(!select.is_values());Sourcepub fn as_values(&self) -> Option<&Values>
pub fn as_values(&self) -> Option<&Values>
Returns a reference to the inner Values if this is an ExprSet::Values.
Returns None for all other ExprSet variants.
Sourcepub fn as_values_unwrap(&self) -> &Values
pub fn as_values_unwrap(&self) -> &Values
Sourcepub fn as_values_mut(&mut self) -> Option<&mut Values>
pub fn as_values_mut(&mut self) -> Option<&mut Values>
Returns a mutable reference to the inner Values if this is an
ExprSet::Values, or None otherwise.
Sourcepub fn as_values_mut_unwrap(&mut self) -> &mut Values
pub fn as_values_mut_unwrap(&mut self) -> &mut Values
Sourcepub fn into_values(self) -> Values
pub fn into_values(self) -> Values
Consumes the expression set and returns the inner Values.
§Panics
Panics (via todo!()) if self is not an ExprSet::Values.
Source§impl ExprSet
impl ExprSet
Sourcepub fn as_select(&self) -> Option<&Select>
pub fn as_select(&self) -> Option<&Select>
Returns a reference to the inner Select if this is a Select variant.
Sourcepub fn as_select_unwrap(&self) -> &Select
pub fn as_select_unwrap(&self) -> &Select
Returns a reference to the inner Select, panicking if this is not a
Select variant.
Sourcepub fn as_select_mut(&mut self) -> Option<&mut Select>
pub fn as_select_mut(&mut self) -> Option<&mut Select>
Returns a mutable reference to the inner Select if this is a
Select variant.
Sourcepub fn as_select_mut_unwrap(&mut self) -> &mut Select
pub fn as_select_mut_unwrap(&mut self) -> &mut Select
Returns a mutable reference to the inner Select, panicking if this
is not a Select variant.
Sourcepub fn into_select(self) -> Select
pub fn into_select(self) -> Select
Trait Implementations§
Source§impl From<SourceModel> for ExprSet
impl From<SourceModel> for ExprSet
Source§fn from(value: SourceModel) -> Self
fn from(value: SourceModel) -> Self
Source§impl<'a, T: Resolve> IntoExprTarget<'a, T> for &'a ExprSet
impl<'a, T: Resolve> IntoExprTarget<'a, T> for &'a ExprSet
Source§fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
self into an ExprTarget using the provided schema.Source§impl<T, const N: usize> Like<[T; N]> for ExprSetwhere
Expr: Like<T>,
Support for matching ExprSet against arrays of any length using const generics
impl<T, const N: usize> Like<[T; N]> for ExprSetwhere
Expr: Like<T>,
Support for matching ExprSet against arrays of any length using const generics
Source§impl<T> Like<Vec<T>> for ExprSetwhere
Expr: Like<T>,
Support for matching ExprSet against Vec patterns
impl<T> Like<Vec<T>> for ExprSetwhere
Expr: Like<T>,
Support for matching ExprSet against Vec patterns