Skip to main content

SQL

Struct SQL 

Source
pub struct SQL<'a, V: SQLParam> {
    pub chunks: SmallVec<[SQLChunk<'a, V>; 8]>,
}
Expand description

A SQL fragment: tokens, identifiers, raw text, and bound parameters.

Every query builder and expression renders to a SQL. V is the driver’s value type (SQLiteValue, PostgresValue, …), which also fixes the dialect used to render placeholders: ? for SQLite and MySQL, $1, $2, ... for PostgreSQL.

Chunks are stored inline for short fragments (up to 8) without a heap allocation.

§Examples

use drizzle_core::{SQL, Token};

let sql: SQL<'_, Value> = SQL::raw("SELECT")
    .append(SQL::ident("name"))
    .push(Token::FROM)
    .append(SQL::ident("users"))
    .push(Token::WHERE)
    .append(SQL::ident("id"))
    .push(Token::EQ)
    .append(SQL::param(Value(7)));

assert_eq!(sql.sql(), r#"SELECT "name" FROM "users" WHERE "id" = ?"#);
assert_eq!(sql.params().collect::<Vec<_>>(), [&Value(7)]);

Fields§

§chunks: SmallVec<[SQLChunk<'a, V>; 8]>

The fragment’s chunks, in order.

Implementations§

Source§

impl<'a, V: SQLParam> SQL<'a, V>

Source

pub const fn empty() -> Self

Creates an empty fragment.

Source

pub fn token(t: Token) -> Self

Creates a fragment holding one keyword or punctuation Token.

Source

pub fn with_capacity_chunks(capacity: usize) -> Self

Creates an empty fragment with room for capacity chunks.

Source

pub fn ident(name: impl Into<Cow<'a, str>>) -> Self

Creates a quoted identifier, such as a table or column name.

The quote character follows the dialect: "name" for SQLite and PostgreSQL, `name` for MySQL.

§Examples
use drizzle_core::SQL;

assert_eq!(SQL::<Value>::ident("user name").sql(), r#""user name""#);
Source

pub fn columns(columns: &[ColumnRef]) -> Self

Creates a comma-separated list of quoted column names, without table qualifiers: "id", "name".

Source

pub fn raw(text: impl Into<Cow<'a, str>>) -> Self

Creates a fragment of raw SQL text, written as-is.

The text is not quoted or escaped. Never pass user input here; bind it with SQL::param instead.

§Examples
use drizzle_core::SQL;

assert_eq!(SQL::<Value>::raw("CURRENT_TIMESTAMP").sql(), "CURRENT_TIMESTAMP");
Source

pub fn number(value: usize) -> Self

Creates an unsigned integer literal, written into the SQL text rather than bound.

Source

pub fn param(value: impl Into<Cow<'a, V>>) -> Self

Creates a bound parameter holding value.

The SQL text gets a placeholder (? or $n); the value travels separately and is returned by SQL::params.

§Examples
use drizzle_core::SQL;

let sql = SQL::param(Value(1)).append(SQL::raw("+")).append(SQL::param(Value(2)));
assert_eq!(sql.sql(), "? + ?");
assert_eq!(sql.params().count(), 2);
Source

pub fn bytes(bytes: impl Into<Cow<'a, [u8]>>) -> Self
where V: From<&'a [u8]> + From<Vec<u8>> + Into<Cow<'a, V>>,

Creates a bound binary parameter (BLOB / bytea).

Prefer this over SQL::param(Vec<u8>), which some value types treat as a list rather than one binary value.

Source

pub fn table(table: TableRef) -> Self

Creates a reference to a table, rendered as its quoted name.

Right after SELECT ... FROM, a table reference also lets the renderer expand an empty projection into the table’s columns.

Source

pub fn column(column: ColumnRef) -> Self

Creates a reference to a column, rendered as "table"."column".

Source

pub fn func(name: &'static str, args: Self) -> Self

Creates a function call: NAME(args).

A subquery argument gets its own parentheses: NAME((SELECT ...)).

§Examples
use drizzle_core::SQL;

let sql = SQL::<Value>::func("LOWER", SQL::ident("email"));
// SQLite and PostgreSQL put a space before `(`; MySQL does not.
assert_eq!(sql.sql(), r#"LOWER ("email")"#);
Source

pub fn append(self, other: impl Into<Self>) -> Self

Appends another fragment and returns the result.

Source

pub fn append_mut(&mut self, other: impl Into<Self>)

Appends another fragment in place.

Source

pub fn push(self, chunk: impl Into<SQLChunk<'a, V>>) -> Self

Appends one chunk (a Token, parameter, …) and returns the result.

Source

pub fn push_mut(&mut self, chunk: impl Into<SQLChunk<'a, V>>)

Appends one chunk in place.

Source

pub fn with_capacity(self, additional: usize) -> Self

Reserves room for additional more chunks.

Source

pub fn join<T>(sqls: T, separator: Token) -> Self
where T: IntoIterator, T::Item: ToSQL<'a, V>,

Joins fragments with a separator token. Returns an empty fragment for an empty iterator.

§Examples
use drizzle_core::{SQL, Token};

let cols = [SQL::<Value>::ident("id"), SQL::ident("name")];
assert_eq!(SQL::join(cols, Token::COMMA).sql(), r#""id", "name""#);
Source

pub fn parens(self) -> Self

Wraps the fragment in parentheses: (self).

Source

pub fn parens_if_subquery(self) -> Self

Wraps the fragment in parentheses only when it is a subquery (see SQL::is_subquery).

Source

pub fn is_subquery(&self) -> bool

Returns true if the fragment starts with a SELECT or WITH token.

Source

pub fn alias(self, name: impl Into<Cow<'a, str>>) -> Self

Appends an alias: self AS "name".

Source

pub fn param_list<I>(values: I) -> Self
where I: IntoIterator, I::Item: Into<Cow<'a, V>>,

Creates a comma-separated list of bound parameters: ?, ?, ?.

Source

pub fn assignments<I, T>(pairs: I) -> Self
where I: IntoIterator<Item = (&'static str, T)>, T: Into<Cow<'a, V>>,

Creates comma-separated assignments with bound values: "col" = ?, "other" = ?.

Source

pub fn assignments_sql<I>(pairs: I) -> Self
where I: IntoIterator<Item = (&'static str, Self)>,

Creates comma-separated assignments from fragments: "col" = <expression>.

Unlike SQL::assignments, which binds each value as a parameter, this keeps each fragment as-is, so placeholders and raw expressions survive.

Source

pub fn map_params<U: SQLParam>(self, f: impl FnMut(V) -> U) -> SQL<'a, U>

Converts every bound value with f, changing the value type to U.

Only parameter chunks change. Useful for converting between owned and borrowed value types (for example OwnedPostgresValue to PostgresValue<'a>).

Source

pub fn into_owned_with<U: SQLParam>( self, f: impl FnMut(V) -> U, ) -> SQL<'static, U>

Copies every borrowed string into owned storage and converts bound values with f, giving a 'static fragment.

Generated models use this to outlive the values they were built from. Identifiers, raw text, placeholders, tables and columns are all kept.

Source

pub fn into_owned(self) -> OwnedSQL<V>

Converts into an OwnedSQL with no borrowed data.

Source

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.

Source

pub fn has_returning(&self) -> bool

Whether this statement has a RETURNING clause (outside any parentheses), so it returns rows although it changes data.

Source

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).

Source

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)]);
Source

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, ....

Source

pub fn write_to(&self, buf: &mut impl Write)

Writes the SQL text to buf, like SQL::sql without allocating a new string.

Source

pub fn write_to_with(&self, buf: &mut impl Write, style: ParamStyle)

Like write_to, but with a caller-chosen placeholder style.

Source

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.

Source

pub fn write_qualified_columns(buf: &mut impl Write, table: &TableSqlRef)

Writes every column of table as "table"."column", separated by commas, or "table".* when the column list is unknown.

Source

pub fn params(&self) -> impl Iterator<Item = &V> + use<'_, V>

Returns the bound values, in order. Placeholders without a value are skipped.

Source

pub fn bind<T: SQLParam + Into<V>>( self, params: impl IntoIterator<Item: Into<ParamBind<'a, T>>>, ) -> Self

Fills named placeholders with values, matching by name.

Placeholders whose name is not in params keep no value. Values can come from TypedPlaceholder::bind, which also checks the value’s SQL type.

§Examples
use drizzle_core::{ParamBind, Placeholder, SQL, ToSQL, Token};

let sql: SQL<'_, Value> = SQL::ident("id")
    .push(Token::EQ)
    .append(Placeholder::named("id").into_sql());
assert_eq!(sql.params().count(), 0);

let bound = sql.bind([ParamBind::new("id", Value(3))]);
assert_eq!(bound.sql(), r#""id" = :id"#);
assert_eq!(bound.params().collect::<Vec<_>>(), [&Value(3)]);

Trait Implementations§

Source§

impl<'a, V, T, N, A, S> AsRef<SQL<'a, V>> for SQLExpr<'a, V, T, N, A, S>

Borrows the inner SQL.

Source§

fn as_ref(&self) -> &SQL<'a, V>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, V: SQLParam + 'a> AsRef<SQL<'a, V>> for SQL<'a, V>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, V: Clone + SQLParam> Clone for SQL<'a, V>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, V: Debug + SQLParam> Debug for SQL<'a, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: SQLParam> Default for SQL<'_, V>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<V: SQLParam + Display> Display for SQL<'_, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, V> Expr<'a, V> for SQL<'a, V>
where V: SQLParam + 'a,

Source§

type SQLType = <<V as SQLParam>::DialectMarker as DialectTypes>::Any

The SQL data type this expression evaluates to.
Source§

type Nullable = Null

Whether this expression can be NULL.
Source§

type Aggregate = Scalar

Whether this is an aggregate (COUNT, SUM) or scalar expression.
Source§

fn to_expr_sql(&self) -> SQL<'a, V>

Renders this value as a scalar expression, borrowing it. Read more
Source§

fn into_expr_sql(self) -> SQL<'a, V>
where Self: Sized,

Renders this value as a scalar expression, consuming it.
Source§

fn to_condition_sql(&self) -> Option<SQL<'a, V>>

Renders this value as one element of a ConditionList. Read more
Source§

fn into_condition_sql(self) -> Option<SQL<'a, V>>
where Self: Sized,

Consuming counterpart of Expr::to_condition_sql.
Source§

impl<V: SQLParam> ExprSources for SQL<'_, V>

Source§

type Sources = ()

Type-level tree with one Src leaf per column read.
Source§

impl<V: SQLParam> ExprValueType for SQL<'_, V>

Raw SQL has no known type (()); the caller must name the row type.

Source§

type ValueType = ()

The decoded Rust type.
Source§

impl<'a, V: SQLParam + 'a> From<&'a str> for SQL<'a, V>

Source§

fn from(s: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, V> From<&T> for SQL<'a, V>
where T: ToSQL<'a, V>, V: SQLParam,

Source§

fn from(value: &T) -> Self

Converts to this type from the input type.
Source§

impl<'a, V: SQLParam> From<SQL<'a, V>> for OwnedSQL<V>

Source§

fn from(value: SQL<'a, V>) -> Self

Converts to this type from the input type.
Source§

impl<'a, V: SQLParam, T: DataType, N: Nullability, A: AggregateKind, S> From<SQLExpr<'a, V, T, N, A, S>> for SQL<'a, V>

Source§

fn from(expr: SQLExpr<'a, V, T, N, A, S>) -> Self

Converts to this type from the input type.
Source§

impl<V: SQLParam> From<Token> for SQL<'_, V>

Source§

fn from(value: Token) -> Self

Converts to this type from the input type.
Source§

impl<'a, V: SQLParam, T> FromIterator<T> for SQL<'a, V>
where SQLChunk<'a, V>: From<T>,

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, V: SQLParam> IntoIterator for SQL<'a, V>

Source§

type Item = SQLChunk<'a, V>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<[SQLChunk<'a, V>; 8]>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<V: SQLParam> IntoSelectTarget for SQL<'_, V>

select(sql!(...)) → SelectExpr — user must specify row type.

Source§

type Marker = SelectExpr

The select marker.
Source§

impl<V: SQLParam> OrderTerm for SQL<'_, V>

Source§

impl<V: SQLParam> ScopeEntry for SQL<'_, V>

Source§

type Key = RawSource

How columns refer to this source: a TableKey or an AliasKey.
Source§

type Nullable = NonNull

Null when an outer join can leave this source NULL.
Source§

type Sources = ()

Sources this source reads itself, such as the tables a derived table’s subquery reads from an outer query. They resolve against the enclosing query (or, for a LATERAL join, the sources joined before it). Tables and views read nothing (()).
Source§

impl<V: SQLParam> SelectQuery for SQL<'_, V>

Source§

impl<'a, V: SQLParam + 'a> ToSQL<'a, V> for SQL<'a, V>

Source§

fn to_sql(&self) -> Self

Renders self as a SQL fragment.
Source§

fn into_sql(self) -> Self

Renders self as a SQL fragment, consuming it. Read more

Auto Trait Implementations§

§

impl<'a, V> Freeze for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: Freeze,

§

impl<'a, V> RefUnwindSafe for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: RefUnwindSafe,

§

impl<'a, V> Send for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: Send,

§

impl<'a, V> Sync for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: Sync,

§

impl<'a, V> Unpin for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: Unpin,

§

impl<'a, V> UnsafeUnpin for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: UnsafeUnpin,

§

impl<'a, V> UnwindSafe for SQL<'a, V>
where SmallVec<[SQLChunk<'a, V>; 8]>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> AliasExt for T
where T: ExprValueType,

Source§

fn alias(self, name: &'static str) -> AliasedExpr<Self>

Renames this expression: expr AS "name".
Source§

fn named<Name: Tag>(self) -> NamedExpr<Self, Name>

Names this expression with a type-level Tag, rendered as expr AS "<Tag::NAME>".
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'a, V, L, R> ComparisonOperand<'a, V, L> for R
where V: SQLParam + 'a, L: Expr<'a, V>, R: Expr<'a, V>, <L as Expr<'a, V>>::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,

Source§

type SQLType = <R as Expr<'a, V>>::SQLType

SQL type of the operand.
Source§

type Nullable = <R as Expr<'a, V>>::Nullable

Whether the operand can be NULL.
Source§

type Aggregate = <R as Expr<'a, V>>::Aggregate

Whether the operand is an aggregate.
Source§

type Sources = <R as ExprSources>::Sources

Tables the operand reads; see ExprSources::Sources.
Source§

fn into_comparison_sql(self) -> SQL<'a, V>

Renders the operand.
Source§

impl<'a, V, E> ExprExt<'a, V> for E
where V: SQLParam, E: Expr<'a, V>,

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>,

Equality comparison (=); 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>,

Inequality comparison (<>); 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>,

Greater-than comparison (>); 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>,

Greater-than-or-equal comparison (>=); 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>,

Less-than comparison (<); 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>,

Less-than-or-equal comparison (<=); 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,

Pattern match (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,

Negated pattern match (NOT LIKE); see not_like.
Source§

fn is_null( self, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>

NULL check (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>>

Non-NULL check (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>,

Inclusive range check (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>,

Negated range check (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>)>
where I: IntoIterator<Item = R>, R: Expr<'a, V>, Self::SQLType: Compatible<R::SQLType>,

Membership in a list of values (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>)>
where I: IntoIterator<Item = R>, R: Expr<'a, V>, Self::SQLType: Compatible<R::SQLType>,

Non-membership in a list of values (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>)>
where S: Expr<'a, V>, Self::SQLType: Compatible<S::SQLType> + Compatible<Self::SQLType>,

Membership in a subquery’s rows (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>)>
where S: Expr<'a, V>, Self::SQLType: Compatible<S::SQLType> + Compatible<Self::SQLType>,

Non-membership in a subquery’s rows (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>,

NULL-safe inequality (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>,

NULL-safe equality (IS NOT DISTINCT FROM); see is_not_distinct_from.
Source§

fn is_true( self, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>

Truth test (IS TRUE); see is_true.
Source§

fn is_false( self, ) -> SQLExpr<'a, V, <V::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate, ScopeOnly<Self::Sources>>

Falsity test (IS FALSE); see is_false.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<List> ListIncludes<Nil, ()> for List

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeEq<T> for T