pub trait ToSQL<'a, V: SQLParam> {
// Required method
fn to_sql(&self) -> SQL<'a, V>;
// Provided methods
fn into_sql(self) -> SQL<'a, V>
where Self: Sized { ... }
fn alias(&self, alias: &'static str) -> SQL<'a, V> { ... }
}Expand description
Trait for types that can be converted to SQL fragments.
The 'a lifetime ties any borrowed parameter values to the resulting SQL
fragment, allowing zero-copy SQL construction when inputs are already
borrowed.
Required Methods§
Provided Methods§
Sourcefn into_sql(self) -> SQL<'a, V>where
Self: Sized,
fn into_sql(self) -> SQL<'a, V>where
Self: Sized,
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.