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”
Subquery(Box<SQL<'a, V>>)
A subquery wrapped in parentheses: “(SELECT …)”
Implementations§
Source§impl<'a, V: SQLParam + 'a> SQLChunk<'a, V>
impl<'a, V: SQLParam + 'a> SQLChunk<'a, V>
Sourcepub const fn text(text: &'static str) -> Self
pub const fn text(text: &'static str) -> Self
Creates a text chunk from a borrowed string - zero allocation
Sourcepub const fn param(value: &'a V, placeholder: Placeholder) -> Self
pub const fn param(value: &'a V, placeholder: Placeholder) -> Self
Creates a parameter chunk with borrowed value and placeholder
Sourcepub const fn table(table: &'static dyn SQLTableInfo) -> Self
pub const fn table(table: &'static dyn SQLTableInfo) -> Self
Creates a table chunk
Sourcepub const fn column(column: &'static dyn SQLColumnInfo) -> Self
pub const fn column(column: &'static dyn SQLColumnInfo) -> Self
Creates a column chunk
Sourcepub fn alias(chunk: SQLChunk<'a, V>, alias: impl Into<CompactString>) -> Self
pub fn alias(chunk: SQLChunk<'a, V>, alias: impl Into<CompactString>) -> Self
Creates an alias chunk wrapping any SQLChunk
Trait Implementations§
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>
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> 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
Mutably borrows from an owned value. Read more