SQLChunk

Enum SQLChunk 

Source
pub enum SQLChunk<'a, V: SQLParam + 'a> {
    Text(Cow<'a, CompactString>),
    Param(Param<'a, V>),
    SQL(Box<SQL<'a, V>>),
    Table(&'static dyn SQLTableInfo),
    Column(&'static dyn SQLColumnInfo),
    Alias {
        chunk: Box<SQLChunk<'a, V>>,
        alias: CompactString,
    },
    Subquery(Box<SQL<'a, V>>),
}
Expand description

A SQL chunk represents a part of an SQL statement.

Variants§

§

Text(Cow<'a, CompactString>)

§

Param(Param<'a, V>)

§

SQL(Box<SQL<'a, V>>)

§

Table(&'static dyn SQLTableInfo)

A table reference that can render itself with proper schema/alias handling

§

Column(&'static dyn SQLColumnInfo)

A column reference that can render itself with proper table qualification

§

Alias

An alias wrapping any SQL chunk: “chunk AS alias”

Fields

§chunk: Box<SQLChunk<'a, V>>
§

Subquery(Box<SQL<'a, V>>)

A subquery wrapped in parentheses: “(SELECT …)”

Implementations§

Source§

impl<'a, V: SQLParam + 'a> SQLChunk<'a, V>

Source

pub const fn text(text: &'static str) -> Self

Creates a text chunk from a borrowed string - zero allocation

Source

pub const fn param(value: &'a V, placeholder: Placeholder) -> Self

Creates a parameter chunk with borrowed value and placeholder

Source

pub fn sql(sql: SQL<'a, V>) -> Self

Creates a nested SQL chunk

Source

pub const fn table(table: &'static dyn SQLTableInfo) -> Self

Creates a table chunk

Source

pub const fn column(column: &'static dyn SQLColumnInfo) -> Self

Creates a column chunk

Source

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

Creates an alias chunk wrapping any SQLChunk

Source

pub fn subquery(sql: SQL<'a, V>) -> Self

Creates a subquery chunk

Trait Implementations§

Source§

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

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

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

Source§

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

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

impl<'a, V: SQLParam> From<SQLChunk<'a, V>> for OwnedSQLChunk<V>

Source§

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

Converts to this type from the input type.

Auto Trait Implementations§

§

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

§

impl<'a, V> !RefUnwindSafe for SQLChunk<'a, V>

§

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

§

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

§

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

§

impl<'a, V> !UnwindSafe for SQLChunk<'a, V>

Blanket Implementations§

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