Skip to main content

SQL

Struct SQL 

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

SQL fragment builder with flat chunk storage.

Uses SmallVec<[SQLChunk; 8]> for inline storage of typical SQL fragments without heap allocation.

Fields§

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

Implementations§

Source§

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

Source

pub const fn empty() -> SQL<'a, V>

Creates an empty SQL fragment

Source

pub fn token(t: Token) -> SQL<'a, V>

Creates SQL with a single token

Source

pub fn with_capacity_chunks(capacity: usize) -> SQL<'a, V>

Creates an empty SQL fragment with pre-allocated chunk capacity.

Source

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

Creates SQL with a quoted identifier

Source

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

Creates SQL with raw text (unquoted)

Source

pub fn number(value: usize) -> SQL<'a, V>

Creates SQL with a single unsigned integer literal.

Source

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

Creates SQL with a single parameter value

Source

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

Creates SQL with a binary parameter value (BLOB/bytea)

Prefer this over SQL::param(Vec<u8>) to avoid list semantics.

Source

pub fn table(table: TableRef) -> SQL<'a, V>

Creates SQL referencing a table

Source

pub fn column(column: ColumnRef) -> SQL<'a, V>

Creates SQL referencing a column

Source

pub fn func(name: &'static str, args: SQL<'a, V>) -> SQL<'a, V>

Creates SQL for a function call: NAME(args) Subqueries are automatically wrapped in parentheses: NAME((SELECT …))

Source

pub fn append(self, other: impl Into<SQL<'a, V>>) -> SQL<'a, V>

Append another SQL fragment (flat extend)

Source

pub fn append_mut(&mut self, other: impl Into<SQL<'a, V>>)

Source

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

Push a single chunk

Source

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

Source

pub fn with_capacity(self, additional: usize) -> SQL<'a, V>

Pre-allocates capacity for additional chunks

Source

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

Joins multiple SQL fragments with a separator

Source

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

Wrap in parentheses: (self)

Source

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

Wrap this SQL fragment in parentheses only when it is a subquery.

Source

pub fn is_subquery(&self) -> bool

Check if this SQL fragment is a subquery (starts with SELECT/WITH).

Source

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

Creates an aliased version: self AS “name”

Source

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

Creates a comma-separated list of parameters. Builds chunks directly without intermediate SQL allocations.

Source

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

Creates a comma-separated list of column assignments: “col” = ? Builds chunks directly without intermediate SQL allocations.

Source

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

Creates a comma-separated list of column assignments from pre-built SQL fragments: “col” =

Unlike assignments() which wraps each value in SQL::param(), this variant accepts pre-built SQL fragments, preserving placeholders and raw expressions. Builds chunks directly without intermediate SQL allocations.

Source

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

Maps parameter values from type V to type U using the provided function.

Only Param chunks are affected; all other chunks pass through unchanged. This is useful for converting between owned and borrowed value types (e.g. OwnedPostgresValuePostgresValue<'a>).

Source

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

Converts to owned version (consuming self to avoid clone)

Source

pub fn sql(&self) -> String

Returns the SQL string with dialect-appropriate placeholders. Uses $1, $2, ... for PostgreSQL, :name or ? for SQLite, ? for MySQL.

Source

pub fn build(&self) -> (String, SmallVec<[&V; 8]>)

Generates the SQL string and collects parameter references in a single pass.

This is the preferred method for driver execution paths since it avoids iterating the chunk list twice (once for sql(), once for params()).

Source

pub fn build_with(&self, style: ParamStyle) -> (String, SmallVec<[&V; 8]>)

Same as build but lets the caller override the placeholder style. Drivers that speak the dialect but bind parameters differently (e.g. AWS Data API on Postgres) use this to emit :1, :2, ... instead of $1, $2, ... without any post-hoc rewriting.

Source

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.

Source

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

Same as 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, )

Write a single chunk with pattern detection

Source

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

Write fully qualified columns for a table

Source

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

Returns an iterator over references to parameter values (avoids allocating a Vec - callers can collect if needed)

Source

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

Bind named parameters

Trait Implementations§

Source§

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

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> Clone for SQL<'a, V>
where V: Clone + SQLParam,

Source§

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

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 for SQL<'a, V>
where V: Debug + SQLParam,

Source§

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

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

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

Source§

fn default() -> SQL<'_, V>

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

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

Source§

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

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>

Render this value as a scalar expression by reference. Read more
Source§

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

Render this value as a scalar expression, consuming it when useful.
Source§

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

Raw SQL fallback — value type is (), user must specify the concrete type.

Source§

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

Source§

fn from(s: &'a str) -> SQL<'a, V>

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) -> SQL<'a, V>

Converts to this type from the input type.
Source§

impl From<OwnedPostgresValue> for SQL<'_, OwnedPostgresValue>

Source§

fn from(value: OwnedPostgresValue) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<PostgresValue<'a>> for SQL<'a, PostgresValue<'a>>

Source§

fn from(value: PostgresValue<'a>) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

fn from(value: Token) -> SQL<'_, V>

Converts to this type from the input type.
Source§

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

Source§

fn from_iter<I>(iter: I) -> SQL<'a, V>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

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

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) -> <SQL<'a, V> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

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

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

Source§

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

Source§

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

Source§

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

Consume self and return SQL without cloning. Default delegates to to_sql() (which clones). Types that own their SQL (like SQL and SQLExpr) override this to avoid the clone.

Auto Trait Implementations§

§

impl<'a, V> Freeze for SQL<'a, V>
where V: Freeze,

§

impl<'a, V> RefUnwindSafe for SQL<'a, V>
where V: RefUnwindSafe,

§

impl<'a, V> Send for SQL<'a, V>
where V: Send + Sync,

§

impl<'a, V> Sync for SQL<'a, V>
where V: Sync,

§

impl<'a, V> Unpin for SQL<'a, V>
where V: Unpin,

§

impl<'a, V> UnsafeUnpin for SQL<'a, V>
where V: UnsafeUnpin,

§

impl<'a, V> UnwindSafe for SQL<'a, V>

Blanket Implementations§

Source§

impl<T> AliasExt for T

Source§

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

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<'a, E> ArrayExprExt<'a> for E
where E: Expr<'a, PostgresValue<'a>>,

Source§

fn array_contains<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>>,

PostgreSQL @> operator - array contains. Read more
Source§

fn array_contained<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>>,

PostgreSQL <@ operator - array is contained by. Read more
Source§

fn array_overlaps<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>>,

PostgreSQL && operator - arrays overlap. 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

Source§

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

Source§

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

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 as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Equality comparison (=). Read more
Source§

fn ne<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Inequality comparison (<>). Read more
Source§

fn gt<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Greater-than comparison (>). Read more
Source§

fn ge<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Greater-than-or-equal comparison (>=). Read more
Source§

fn lt<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Less-than comparison (<). Read more
Source§

fn le<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

Less-than-or-equal comparison (<=). Read more
Source§

fn like<R>( self, pattern: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
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, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

LIKE pattern matching. Read more
Source§

fn not_like<R>( self, pattern: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
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, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

NOT LIKE pattern matching. Read more
Source§

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

IS NULL check. Read more
Source§

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

IS NOT NULL check. Read more
Source§

fn between<L, H>( self, low: L, high: H, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
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>, Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>, <Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,

BETWEEN comparison. Read more
Source§

fn not_between<L, H>( self, low: L, high: H, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <<Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output as AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
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>, Self::Aggregate: AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>, <Self::Aggregate as AggOr<<L as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output: AggOr<<H as ComparisonOperand<'a, V, Self>>::Aggregate>,

NOT BETWEEN comparison. Read more
Source§

fn in_array<I, R>( self, values: I, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
where I: IntoIterator<Item = R>, R: Expr<'a, V>, Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,

IN array check. Read more
Source§

fn not_in_array<I, R>( self, values: I, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
where I: IntoIterator<Item = R>, R: Expr<'a, V>, Self::SQLType: Compatible<<R as Expr<'a, V>>::SQLType>,

NOT IN array check. Read more
Source§

fn in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
where S: Expr<'a, V>, Self::SQLType: Compatible<<S as Expr<'a, V>>::SQLType>,

IN subquery check.
Source§

fn not_in_subquery<S>( self, subquery: S, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, Self::Aggregate>
where S: Expr<'a, V>, Self::SQLType: Compatible<<S as Expr<'a, V>>::SQLType>,

NOT IN subquery check.
Source§

fn is_distinct_from<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

IS DISTINCT FROM - NULL-safe inequality comparison. Read more
Source§

fn is_not_distinct_from<R>( self, other: R, ) -> SQLExpr<'a, V, <<V as SQLParam>::DialectMarker as DialectTypes>::Bool, NonNull, <Self::Aggregate as AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>>::Output>
where R: ComparisonOperand<'a, V, Self>, Self::SQLType: Compatible<<R as ComparisonOperand<'a, V, Self>>::SQLType>, Self::Aggregate: AggOr<<R as ComparisonOperand<'a, V, Self>>::Aggregate>,

IS NOT DISTINCT FROM - NULL-safe equality comparison. Read more
Source§

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

IS TRUE - boolean test that handles NULL. Read more
Source§

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

IS FALSE - boolean test that handles NULL. Read more
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<'a, E> JsonExprExt<'a> for E
where E: Expr<'a, PostgresValue<'a>>,

Source§

fn json_get( self, key: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Json, Null, Scalar>

Get JSON object field by key (-> operator), returns JSON.
Source§

fn json_get_idx( self, index: i32, ) -> SQLExpr<'a, PostgresValue<'a>, Json, Null, Scalar>

Get JSON array element by index (-> operator), returns JSON.
Source§

fn json_get_text( self, key: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Text, Null, Scalar>

Get JSON object field as text (->> operator).
Source§

fn json_get_text_idx( self, index: i32, ) -> SQLExpr<'a, PostgresValue<'a>, Text, Null, Scalar>

Get JSON array element as text (->> operator).
Source§

fn json_get_path( self, path: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Json, Null, Scalar>

Get JSON object at path (#> operator), returns JSON.
Source§

fn json_get_path_text( self, path: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Text, Null, Scalar>

Get JSON object at path as text (#>> operator).
Source§

fn jsonb_contains<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>>,

JSONB contains (@> operator).
Source§

fn jsonb_contained<R>( self, other: R, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where R: ToSQL<'a, PostgresValue<'a>>,

JSONB is contained by (<@ operator).
Source§

fn jsonb_exists_key( self, key: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>

JSONB key exists (? operator).
Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<'a, E> RegexExprExt<'a> for E
where E: Expr<'a, PostgresValue<'a>>,

Source§

fn regex_match( self, pattern: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>

Case-sensitive regex match (~ operator).
Source§

fn regex_match_ci( self, pattern: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>

Case-insensitive regex match (~* operator).
Source§

fn regex_not_match( self, pattern: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>

Case-sensitive regex non-match (!~ operator).
Source§

fn regex_not_match_ci( self, pattern: &'a str, ) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>

Case-insensitive regex non-match (!~* operator).
Source§

impl<Scope> ScopeSatisfies<Nil, ()> for Scope

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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