pub struct SQLExpr<'a, V: SQLParam, T: DataType, N: Nullability = NonNull, A: AggregateKind = Scalar> { /* private fields */ }Expand description
A SQL expression that carries type information.
This wrapper preserves the SQL type through operations, enabling compile-time type checking of SQL expressions.
§Type Parameters
'a: Lifetime of borrowed dataV: The dialect’s value type (SQLiteValue, PostgresValue)T: The SQL data type marker (Int, Text, etc.)N: The nullability marker (NonNull or Null)A: The aggregation marker (Scalar or Agg)
§Example
use drizzle_core::expr::{SQLExpr, NonNull, Scalar};
use drizzle_core::types::Int;
let expr: SQLExpr<'_, SQLiteValue, Int, NonNull, Scalar> = ...;Implementations§
Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> SQLExpr<'a, V, T, N, A>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> SQLExpr<'a, V, T, N, A>
Methods from Deref<Target = SQL<'a, V>>§
Sourcepub fn is_subquery(&self) -> bool
pub fn is_subquery(&self) -> bool
Check if this SQL fragment is a subquery (starts with SELECT)
Sourcepub fn sql(&self) -> String
pub fn sql(&self) -> String
Returns the SQL string with dialect-appropriate placeholders
Uses $1, $2, ... for PostgreSQL, ? for SQLite/MySQL
Sourcepub fn write_to(&self, buf: &mut impl Write)
pub fn write_to(&self, buf: &mut impl Write)
Write SQL to a buffer with dialect-appropriate placeholders
Uses $1, $2, ... for PostgreSQL, ? or :name for SQLite, ? for MySQL
Named placeholders use :name syntax only for SQLite; PostgreSQL always uses $N
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, )
Write a single chunk with pattern detection
Sourcepub fn write_qualified_columns(
&self,
buf: &mut impl Write,
table: &dyn SQLTableInfo,
)
pub fn write_qualified_columns( &self, buf: &mut impl Write, table: &dyn SQLTableInfo, )
Write fully qualified columns
Trait Implementations§
Source§impl<'a, V, T, N, A, Rhs> Add<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
impl<'a, V, T, N, A, Rhs> Add<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
Source§impl<'a, V, T, N, A> AsRef<SQL<'a, V>> for SQLExpr<'a, V, T, N, A>
Provides reference conversion to inner SQL.
impl<'a, V, T, N, A> AsRef<SQL<'a, V>> for SQLExpr<'a, V, T, N, A>
Provides reference conversion to inner SQL.
Source§impl<'a, V, N, A, Rhs> BitAnd<Rhs> for SQLExpr<'a, V, Bool, N, A>
Implements expr1 & expr2 for boolean expressions (SQL AND).
impl<'a, V, N, A, Rhs> BitAnd<Rhs> for SQLExpr<'a, V, Bool, N, A>
Implements expr1 & expr2 for boolean expressions (SQL AND).
Source§impl<'a, V, N, A, Rhs> BitOr<Rhs> for SQLExpr<'a, V, Bool, N, A>
Implements expr1 | expr2 for boolean expressions (SQL OR).
impl<'a, V, N, A, Rhs> BitOr<Rhs> for SQLExpr<'a, V, Bool, N, A>
Implements expr1 | expr2 for boolean expressions (SQL OR).
Source§impl<'a, V: Clone + SQLParam, T: Clone + DataType, N: Clone + Nullability, A: Clone + AggregateKind> Clone for SQLExpr<'a, V, T, N, A>
impl<'a, V: Clone + SQLParam, T: Clone + DataType, N: Clone + Nullability, A: Clone + AggregateKind> Clone for SQLExpr<'a, V, T, N, A>
Source§impl<'a, V: Debug + SQLParam, T: Debug + DataType, N: Debug + Nullability, A: Debug + AggregateKind> Debug for SQLExpr<'a, V, T, N, A>
impl<'a, V: Debug + SQLParam, T: Debug + DataType, N: Debug + Nullability, A: Debug + AggregateKind> Debug for SQLExpr<'a, V, T, N, A>
Source§impl<'a, V, T, N, A> Deref for SQLExpr<'a, V, T, N, A>
Provides transparent access to inner SQL methods via Deref coercion.
impl<'a, V, T, N, A> Deref for SQLExpr<'a, V, T, N, A>
Provides transparent access to inner SQL methods via Deref coercion.
Source§impl<'a, V, T, N, A> Display for SQLExpr<'a, V, T, N, A>
Display the SQL expression as a string.
impl<'a, V, T, N, A> Display for SQLExpr<'a, V, T, N, A>
Display the SQL expression as a string.
Source§impl<'a, V, T, N, A, Rhs> Div<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
impl<'a, V, T, N, A, Rhs> Div<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> Expr<'a, V> for SQLExpr<'a, V, T, N, A>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> Expr<'a, V> for SQLExpr<'a, V, T, N, A>
Source§impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> From<SQLExpr<'a, V, T, N, A>> for SQL<'a, V>
impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind> From<SQLExpr<'a, V, T, N, A>> for SQL<'a, V>
Source§impl<'a, V, T, N, A, Rhs> Mul<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
impl<'a, V, T, N, A, Rhs> Mul<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
Source§impl<'a, V, N, A> Not for SQLExpr<'a, V, Bool, N, A>
Implements !expr for boolean expressions (SQL NOT).
impl<'a, V, N, A> Not for SQLExpr<'a, V, Bool, N, A>
Implements !expr for boolean expressions (SQL NOT).
Source§impl<'a, V, T, N, A, Rhs> Rem<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
impl<'a, V, T, N, A, Rhs> Rem<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
Source§impl<'a, V, T, N, A, Rhs> Sub<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
impl<'a, V, T, N, A, Rhs> Sub<Rhs> for SQLExpr<'a, V, T, N, A>where
V: SQLParam + 'a,
T: ArithmeticOutput<Rhs::SQLType>,
N: Nullability + NullOr<Rhs::Nullable>,
A: AggregateKind,
Rhs: Expr<'a, V>,
Rhs::SQLType: Numeric,
Rhs::Nullable: Nullability,
Auto Trait Implementations§
impl<'a, V, T, N, A> Freeze for SQLExpr<'a, V, T, N, A>where
V: Freeze,
impl<'a, V, T, N = NonNull, A = Scalar> !RefUnwindSafe for SQLExpr<'a, V, T, N, A>
impl<'a, V, T, N, A> Send for SQLExpr<'a, V, T, N, A>
impl<'a, V, T, N, A> Sync for SQLExpr<'a, V, T, N, A>
impl<'a, V, T, N, A> Unpin for SQLExpr<'a, V, T, N, A>
impl<'a, V, T, N = NonNull, A = Scalar> !UnwindSafe for SQLExpr<'a, V, T, N, A>
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<'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, Bool, NonNull, Scalar>
fn eq<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
=). Read moreSource§fn ne<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn ne<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
<>). Read moreSource§fn gt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn gt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
>). Read moreSource§fn ge<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn ge<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
>=). Read moreSource§fn lt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn lt<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
<). Read moreSource§fn le<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn le<R>(self, other: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
<=). Read moreSource§fn like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Source§fn not_like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn not_like<R>(self, pattern: R) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
Source§fn between<L, H>(self, low: L, high: H) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
fn between<L, H>(self, low: L, high: H) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
Source§fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
fn not_between<L, H>(
self,
low: L,
high: H,
) -> SQLExpr<'a, V, Bool, NonNull, Scalar>where
L: Expr<'a, V>,
H: Expr<'a, V>,
Self::SQLType: Compatible<L::SQLType> + Compatible<H::SQLType>,
Source§fn in_array<I, R>(self, values: I) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
fn in_array<I, R>(self, values: I) -> SQLExpr<'a, V, Bool, NonNull, Scalar>
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