pub enum SQLChunk<'a, V: SQLParam> {
Token(Token),
Ident(Cow<'a, str>),
Raw(Cow<'a, str>),
Number(usize),
Param(Param<'a, V>),
Table(TableSqlRef),
Column(ColumnSqlRef),
}Expand description
A SQL chunk represents a part of an SQL statement.
Each variant has a clear semantic purpose:
Token- SQL keywords and operators (SELECT, FROM, =, etc.)Ident- Quoted identifiers (“table_name”, “column_name”)Raw- Unquoted raw SQL text (function names, expressions)Param- Parameter placeholders with valuesTable- Table reference viaTableSqlRefColumn- Column reference viaColumnSqlRef
Variants§
Token(Token)
SQL keywords and operators: SELECT, FROM, WHERE, =, AND, etc. Renders as: keyword with automatic spacing rules
Ident(Cow<'a, str>)
Quoted identifier for user-provided names Renders as: “name” (with quotes) Use for: table names, column names, alias names
Raw(Cow<'a, str>)
Raw SQL text (unquoted) for expressions, function names Renders as: text (no quotes, as-is) Use for: function names like COUNT, expressions, numeric literals
Number(usize)
Unsigned integer SQL literal rendered directly without heap allocation.
Primarily used for clauses like LIMIT/OFFSET where numeric literals are embedded directly in SQL text rather than parameterized.
Param(Param<'a, V>)
Parameter with value and placeholder Renders as: ? or $1 or :name depending on placeholder style
Table(TableSqlRef)
Table reference with static name and column names.
Renders as: “table_name”
Column names used for SELECT * expansion.
Column(ColumnSqlRef)
Column reference with static table and column names.
Renders as: “table_name"."column_name”
Implementations§
Source§impl<'a, V: SQLParam> SQLChunk<'a, V>
impl<'a, V: SQLParam> SQLChunk<'a, V>
Sourcepub const fn ident_static(name: &'static str) -> Self
pub const fn ident_static(name: &'static str) -> Self
Creates a quoted identifier from a static string - const
Sourcepub const fn raw_static(text: &'static str) -> Self
pub const fn raw_static(text: &'static str) -> Self
Creates raw SQL text from a static string - const
Sourcepub const fn param_borrowed(value: &'a V, placeholder: Placeholder) -> Self
pub const fn param_borrowed(value: &'a V, placeholder: Placeholder) -> Self
Creates a parameter chunk with borrowed value - const
Sourcepub fn ident(name: impl Into<Cow<'a, str>>) -> Self
pub fn ident(name: impl Into<Cow<'a, str>>) -> Self
Creates a quoted identifier from a runtime string
Sourcepub fn param(value: impl Into<Cow<'a, V>>, placeholder: Placeholder) -> Self
pub fn param(value: impl Into<Cow<'a, V>>, placeholder: Placeholder) -> Self
Creates a parameter chunk with owned value