pub struct SQLExpr<'a, V: SQLParam, T: DataType, N: Nullability = NonNull, A: AggregateKind = Scalar, S = ()> { /* private fields */ }Expand description
A SQL fragment together with its type information.
Every function in crate::expr returns an SQLExpr. The type
parameters record what the fragment produces:
'a: lifetime of borrowed values inside it;V: the dialect’s value type (SQLiteValue,PostgresValue, …);T: the SQL data type marker;N:NonNullorNull;A:ScalarorAgg;S: the tables it reads (seecrate::scope).
SQLExpr dereferences to SQL, so methods such as SQL::sql work on
it directly. The Rust operators + - * / % and unary - do arithmetic on
numeric expressions, and & | ! combine boolean ones.
§Examples
let total = users.age.clone() * 2 + 1;
assert_eq!(total.sql(), r#""users"."age" * ? + ?"#);Implementations§
Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> SQLExpr<'a, V, T, N, A, S>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> SQLExpr<'a, V, T, N, A, S>
Source§impl<'a, V, T, N, S> SQLExpr<'a, V, T, N, Agg, S>
impl<'a, V, T, N, S> SQLExpr<'a, V, T, N, Agg, S>
Sourcepub fn over<W>(
self,
spec: WindowSpec<'a, V, W>,
) -> SQLExpr<'a, V, T, N, Scalar, (S, W)>
pub fn over<W>( self, spec: WindowSpec<'a, V, W>, ) -> SQLExpr<'a, V, T, N, Scalar, (S, W)>
Turns this aggregate into a window function (agg OVER (...)).
The result keeps the SQL type and nullability but is scalar, so it can be selected next to plain columns.
§Examples
let per_name = sum(users.score).over(window().partition_by([users.name]));
assert_eq!(
per_name.sql(),
r#"SUM ("users"."score") OVER (PARTITION BY "users"."name")"#
);Sourcepub fn filter<C>(
self,
condition: C,
) -> SQLExpr<'a, V, T, N, Agg, (S, ScopeOnly<C::Sources>)>
pub fn filter<C>( self, condition: C, ) -> SQLExpr<'a, V, T, N, Agg, (S, ScopeOnly<C::Sources>)>
Limits the rows an aggregate sees (agg FILTER (WHERE condition)), on
SQLite and PostgreSQL.
The condition must be boolean. The result is still an aggregate.
§Examples
let adults = count(users.id).filter(gt(users.age, 18));
assert_eq!(
adults.sql(),
r#"COUNT ("users"."id") FILTER (WHERE "users"."age" > ?)"#
);Methods from Deref<Target = SQL<'a, V>>§
Sourcepub fn is_subquery(&self) -> bool
pub fn is_subquery(&self) -> bool
Returns true if the fragment starts with a SELECT or WITH token.
Sourcepub fn sql(&self) -> String
pub fn sql(&self) -> String
Renders the SQL text.
Placeholders follow the dialect of V: $1, $2, ... for PostgreSQL,
:name (named) or ? for SQLite, and ? for MySQL. Use
SQL::build to get the parameters in the same pass.
Sourcepub fn has_returning(&self) -> bool
pub fn has_returning(&self) -> bool
Whether this statement has a RETURNING clause (outside any
parentheses), so it returns rows although it changes data.
Sourcepub fn inline_sql(&self) -> Option<String>
pub fn inline_sql(&self) -> Option<String>
Renders the SQL text with every bound value written as a literal instead of a placeholder.
For statements that cannot take parameters, such as the body of a
CREATE VIEW. Returns None when a placeholder has no bound value,
or a value has no literal form in this dialect (see
SQLParam::write_literal).
Sourcepub fn build(&self) -> (String, SmallVec<[&V; 8]>)
pub fn build(&self) -> (String, SmallVec<[&V; 8]>)
Renders the SQL text and collects the bound values in one pass.
Drivers use this to execute a statement. Placeholders without a bound
value are rendered but not collected. For SQLite, a named placeholder
that appears more than once is collected once, since SQLite gives each
distinct :name a single slot.
§Examples
use drizzle_core::SQL;
let sql = SQL::raw("SELECT").append(SQL::param(Value(1)));
let (text, params) = sql.build();
assert_eq!(text, "SELECT ?");
assert_eq!(params.as_slice(), [&Value(1)]);Sourcepub fn build_with(&self, style: ParamStyle) -> (String, SmallVec<[&V; 8]>)
pub fn build_with(&self, style: ParamStyle) -> (String, SmallVec<[&V; 8]>)
Like build, but with a caller-chosen placeholder
style.
For drivers that speak the dialect but bind parameters differently,
such as the AWS Data API on PostgreSQL, which needs :1, :2, ...
instead of $1, $2, ....
Sourcepub fn write_to(&self, buf: &mut impl Write)
pub fn write_to(&self, buf: &mut impl Write)
Writes the SQL text to buf, like SQL::sql without allocating a
new string.
Sourcepub fn write_to_with(&self, buf: &mut impl Write, style: ParamStyle)
pub fn write_to_with(&self, buf: &mut impl Write, style: ParamStyle)
Like write_to, but with a caller-chosen
placeholder style.
Sourcepub fn write_chunk_to(
&self,
buf: &mut impl Write,
chunk: &SQLChunk<'a, V>,
index: usize,
)
pub fn write_chunk_to( &self, buf: &mut impl Write, chunk: &SQLChunk<'a, V>, index: usize, )
Writes the chunk at index to buf, expanding an empty SELECT
projection that ends at this chunk.
Does not write the space that may follow the chunk.
Trait Implementations§
Source§impl<'a, V, T, N, A, S, Rhs> Add<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, AddOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, AddOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
impl<'a, V, T, N, A, S, Rhs> Add<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, AddOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, AddOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
Source§type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, AddOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, AddOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, AddOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, AddOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
+ operator.Source§impl<'a, V, T, N, A, S> AsRef<SQL<'a, V>> for SQLExpr<'a, V, T, N, A, S>
Borrows the inner SQL.
impl<'a, V, T, N, A, S> AsRef<SQL<'a, V>> for SQLExpr<'a, V, T, N, A, S>
Borrows the inner SQL.
Source§impl<'a, V, T, N, A, S, Rhs> BitAnd<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: BooleanLike,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: BooleanLike,
Rhs::Nullable: Nullability,
left & right renders (left AND right); see and.
impl<'a, V, T, N, A, S, Rhs> BitAnd<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: BooleanLike,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: BooleanLike,
Rhs::Nullable: Nullability,
left & right renders (left AND right); see and.
Source§type Output = SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, <N as Nullability>::Or<<Rhs as Expr<'a, V>>::Nullable>, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, <N as Nullability>::Or<<Rhs as Expr<'a, V>>::Nullable>, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
& operator.Source§impl<'a, V, T, N, A, S, Rhs> BitOr<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: BooleanLike,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: BooleanLike,
Rhs::Nullable: Nullability,
left | right renders (left OR right); see or.
impl<'a, V, T, N, A, S, Rhs> BitOr<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: BooleanLike,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: BooleanLike,
Rhs::Nullable: Nullability,
left | right renders (left OR right); see or.
Source§type Output = SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, <N as Nullability>::Or<<Rhs as Expr<'a, V>>::Nullable>, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, <N as Nullability>::Or<<Rhs as Expr<'a, V>>::Nullable>, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
| operator.Source§impl<'a, V: Clone + SQLParam, T: Clone + DataType, N: Clone + Nullability, A: Clone + AggregateKind, S: Clone> Clone for SQLExpr<'a, V, T, N, A, S>
impl<'a, V: Clone + SQLParam, T: Clone + DataType, N: Clone + Nullability, A: Clone + AggregateKind, S: Clone> Clone for SQLExpr<'a, V, T, N, A, S>
Source§impl<'a, V: Debug + SQLParam, T: Debug + DataType, N: Debug + Nullability, A: Debug + AggregateKind, S: Debug> Debug for SQLExpr<'a, V, T, N, A, S>
impl<'a, V: Debug + SQLParam, T: Debug + DataType, N: Debug + Nullability, A: Debug + AggregateKind, S: Debug> Debug for SQLExpr<'a, V, T, N, A, S>
Source§impl<V, T, N, A, S> Display for SQLExpr<'_, V, T, N, A, S>
Formats the expression like its inner SQL.
impl<V, T, N, A, S> Display for SQLExpr<'_, V, T, N, A, S>
Formats the expression like its inner SQL.
Source§impl<'a, V, T, N, A, S, Rhs> Div<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, DivOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, DivOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
impl<'a, V, T, N, A, S, Rhs> Div<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, DivOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, DivOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
Source§type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, DivOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, DivOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, DivOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, DivOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
/ operator.Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> Expr<'a, V> for SQLExpr<'a, V, T, N, A, S>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> Expr<'a, V> for SQLExpr<'a, V, T, N, A, S>
Source§fn to_expr_sql(&self) -> SQL<'a, V>
fn to_expr_sql(&self) -> SQL<'a, V>
Source§fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_expr_sql(self) -> SQL<'a, V>where
Self: Sized,
Source§fn to_condition_sql(&self) -> Option<SQL<'a, V>>
fn to_condition_sql(&self) -> Option<SQL<'a, V>>
ConditionList. Read moreSource§fn into_condition_sql(self) -> Option<SQL<'a, V>>where
Self: Sized,
fn into_condition_sql(self) -> Option<SQL<'a, V>>where
Self: Sized,
Expr::to_condition_sql.Source§impl<V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> ExprSources for SQLExpr<'_, V, T, N, A, S>
impl<V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> ExprSources for SQLExpr<'_, V, T, N, A, S>
Source§impl<V: SQLParam, T, N, A, S> ExprValueType for SQLExpr<'_, V, T, N, A, S>where
T: DataType + SQLTypeToRust<V::DialectMarker>,
N: Nullability + WrapNullable<<T as SQLTypeToRust<V::DialectMarker>>::RustType>,
A: AggregateKind,
impl<V: SQLParam, T, N, A, S> ExprValueType for SQLExpr<'_, V, T, N, A, S>where
T: DataType + SQLTypeToRust<V::DialectMarker>,
N: Nullability + WrapNullable<<T as SQLTypeToRust<V::DialectMarker>>::RustType>,
A: AggregateKind,
Source§type ValueType = <N as WrapNullable<<T as SQLTypeToRust<<V as SQLParam>::DialectMarker>>::RustType>>::Output
type ValueType = <N as WrapNullable<<T as SQLTypeToRust<<V as SQLParam>::DialectMarker>>::RustType>>::Output
Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> From<SQLExpr<'a, V, T, N, A, S>> for SQL<'a, V>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> From<SQLExpr<'a, V, T, N, A, S>> for SQL<'a, V>
Source§impl<V: SQLParam, T, N, A, S> GroupByIdentity for SQLExpr<'_, V, T, N, A, S>
impl<V: SQLParam, T, N, A, S> GroupByIdentity for SQLExpr<'_, V, T, N, A, S>
Source§impl<V, T, N, A, S> HasAggStatus for SQLExpr<'_, V, T, N, A, S>
impl<V, T, N, A, S> HasAggStatus for SQLExpr<'_, V, T, N, A, S>
Source§impl<V: SQLParam, T, N, A, S> IntoSelectTarget for SQLExpr<'_, V, T, N, A, S>
select(typed_expr) → SelectCols<(Expr,)> — single typed expression.
impl<V: SQLParam, T, N, A, S> IntoSelectTarget for SQLExpr<'_, V, T, N, A, S>
select(typed_expr) → SelectCols<(Expr,)> — single typed expression.
Source§type Marker = SelectCols<(SQLExpr<'_, V, T, N, A, S>,)>
type Marker = SelectCols<(SQLExpr<'_, V, T, N, A, S>,)>
Source§impl<'a, V, T, N, A, S, Rhs> Mul<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, MulOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, MulOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
impl<'a, V, T, N, A, S, Rhs> Mul<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, MulOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, MulOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
Source§type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, MulOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, MulOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, MulOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, MulOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
* operator.Source§impl<'a, V, T, N, A, S, Rhs> Rem<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, RemOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, RemOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
impl<'a, V, T, N, A, S, Rhs> Rem<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, RemOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, RemOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
Source§type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, RemOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, RemOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, RemOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, RemOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
% operator.Source§impl<'a, V, T, N, A, S, Rhs> Sub<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, SubOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, SubOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
impl<'a, V, T, N, A, S, Rhs> Sub<Rhs> for SQLExpr<'a, V, T, N, A, S>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType, SubOp>,
N: Nullability,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
<T as ArithmeticOutput<Rhs::SQLType, SubOp>>::Nullability: ResolveArithmeticNullability<N, Rhs::Nullable>,
Source§type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, SubOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, SubOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
type Output = SQLExpr<'a, V, <T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, SubOp>>::Output, <<T as ArithmeticOutput<<Rhs as Expr<'a, V>>::SQLType, SubOp>>::Nullability as ResolveArithmeticNullability<N, <Rhs as Expr<'a, V>>::Nullable>>::Output, <A as AggregateKind>::Or<<Rhs as Expr<'a, V>>::Aggregate>, (S, <Rhs as ExprSources>::Sources)>
- operator.Auto Trait Implementations§
impl<'a, V, T, N, A, S> Freeze for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> RefUnwindSafe for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> Send for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> Sync for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> Unpin for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> UnsafeUnpin for SQLExpr<'a, V, T, N, A, S>
impl<'a, V, T, N, A, S> UnwindSafe for SQLExpr<'a, V, T, N, A, S>
Blanket Implementations§
Source§impl<T> AliasExt for Twhere
T: ExprValueType,
impl<T> AliasExt for Twhere
T: ExprValueType,
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<'a, V, L, R> ComparisonOperand<'a, V, L> for R
impl<'a, V, L, R> ComparisonOperand<'a, V, L> for R
Source§type Sources = <R as ExprSources>::Sources
type Sources = <R as ExprSources>::Sources
ExprSources::Sources.Source§fn into_comparison_sql(self) -> SQL<'a, V>
fn into_comparison_sql(self) -> SQL<'a, V>
Source§impl<'a, V, E> ExprExt<'a, V> for E
impl<'a, V, E> ExprExt<'a, V> for E
Source§fn eq<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn eq<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
=); see eq.Source§fn ne<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn ne<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
<>); see ne.Source§fn gt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn gt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
>); see gt.Source§fn ge<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn ge<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
>=); see gte.Source§fn lt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn lt<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
<); see lt.Source§fn le<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn le<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
<=); see lte.Source§fn like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
fn like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
LIKE); see like.Source§fn not_like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
fn not_like<R>(
self,
pattern: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, Arg<<R as ComparisonOperand<'a, V, Self>>::Nullable, <R as ComparisonOperand<'a, V, Self>>::Sources>)>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType> + Textual,
<R as ComparisonOperand<'a, V, Self>>::SQLType: Textual,
NOT LIKE); see not_like.Source§fn is_null(
self,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>
fn is_null( self, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>
IS NULL); see is_null.Source§fn is_not_null(
self,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>
fn is_not_null( self, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>
IS NOT NULL); see is_not_null.Source§fn between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggregateKind>::Or<<L as ComparisonOperand<'a, V, Self>>::Aggregate> as AggregateKind>::Or<<H as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, (Arg<<L as ComparisonOperand<'a, V, Self>>::Nullable, <L as ComparisonOperand<'a, V, Self>>::Sources>, Arg<<H as ComparisonOperand<'a, V, Self>>::Nullable, <H as ComparisonOperand<'a, V, Self>>::Sources>))>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
fn between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggregateKind>::Or<<L as ComparisonOperand<'a, V, Self>>::Aggregate> as AggregateKind>::Or<<H as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, (Arg<<L as ComparisonOperand<'a, V, Self>>::Nullable, <L as ComparisonOperand<'a, V, Self>>::Sources>, Arg<<H as ComparisonOperand<'a, V, Self>>::Nullable, <H as ComparisonOperand<'a, V, Self>>::Sources>))>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
BETWEEN); see between.Source§fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggregateKind>::Or<<L as ComparisonOperand<'a, V, Self>>::Aggregate> as AggregateKind>::Or<<H as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, (Arg<<L as ComparisonOperand<'a, V, Self>>::Nullable, <L as ComparisonOperand<'a, V, Self>>::Sources>, Arg<<H as ComparisonOperand<'a, V, Self>>::Nullable, <H as ComparisonOperand<'a, V, Self>>::Sources>))>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggregateKind>::Or<<L as ComparisonOperand<'a, V, Self>>::Aggregate> as AggregateKind>::Or<<H as ComparisonOperand<'a, V, Self>>::Aggregate>, (Arg<<Self as Expr<'a, V>>::Nullable, <Self as ExprSources>::Sources>, (Arg<<L as ComparisonOperand<'a, V, Self>>::Nullable, <L as ComparisonOperand<'a, V, Self>>::Sources>, Arg<<H as ComparisonOperand<'a, V, Self>>::Nullable, <H as ComparisonOperand<'a, V, Self>>::Sources>))>where
L: ComparisonOperand<'a, V, Self>,
H: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<L as ComparisonOperand<'a, V, Self>>::SQLType> + Compatible<<H as ComparisonOperand<'a, V, Self>>::SQLType>,
NOT BETWEEN); see not_between.Source§fn in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
fn in_array<I, R>( self, values: I, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
IN (...)); see in_array.Source§fn not_in_array<I, R>(
self,
values: I,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
fn not_in_array<I, R>( self, values: I, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<R::Nullable, R::Sources>)>
NOT IN (...)); see
not_in_array.Source§fn in_subquery<S>(
self,
subquery: S,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<S::Nullable, S::Sources>)>
fn in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<S::Nullable, S::Sources>)>
IN (SELECT ...)); see
in_subquery.Source§fn not_in_subquery<S>(
self,
subquery: S,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<S::Nullable, S::Sources>)>
fn not_in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, (Arg<Self::Nullable, Self::Sources>, Arg<S::Nullable, S::Sources>)>
NOT IN (SELECT ...)); see
not_in_subquery.Source§fn is_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, ScopeOnly<(<Self as ExprSources>::Sources, <R as ComparisonOperand<'a, V, Self>>::Sources)>>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn is_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, ScopeOnly<(<Self as ExprSources>::Sources, <R as ComparisonOperand<'a, V, Self>>::Sources)>>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
IS DISTINCT FROM); see is_distinct_from.Source§fn is_not_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, ScopeOnly<(<Self as ExprSources>::Sources, <R as ComparisonOperand<'a, V, Self>>::Sources)>>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
fn is_not_distinct_from<R>(
self,
other: R,
) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggregateKind>::Or<<R as ComparisonOperand<'a, V, Self>>::Aggregate>, ScopeOnly<(<Self as ExprSources>::Sources, <R as ComparisonOperand<'a, V, Self>>::Sources)>>where
R: ComparisonOperand<'a, V, Self>,
Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>,
IS NOT DISTINCT FROM); see is_not_distinct_from.impl<List> ListIncludes<Nil, ()> for List
impl<Mk> MarkerAggValidFor<()> for Mk
impl<E, Grouped> SingleColGroupCheck<Grouped, AggSkip> for Ewhere
E: HasAggStatus<Status = AllAgg>,
impl<E, Grouped, W> SingleColGroupCheck<Grouped, ScalarCheck<W>> for Ewhere
E: HasAggStatus<Status = AllScalar> + GroupByIdentity,
Grouped: ListContains<<E as GroupByIdentity>::Identity, W>,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more