macro_rules! bsql {
{ @ [ $builder:expr ] } => { ... };
{ @ [ $builder:expr ] $str:literal $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] $value:ident $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] ($value:expr) $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] { $fragment:expr } $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] [ $($elem:tt)* ] $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] .$method:ident($($params:tt)*) $($rest:tt)* } => { ... };
{ @ [ $builder:expr ] $($wrong:tt)+ } => { ... };
{ $($input:tt)* } => { ... };
}Expand description
Generates an [impl Bsql].
Expands to an expression of type Builder<impl Bsql>.
Input can contain the following pieces:
-
“string literal”: Plain literal sql text.
Equivalent to a call to [
Builder.text()]. -
(value): A single bind value,impl ToSql + Sync.SQL text:
?Equivalent to a call to [
Builder.value()]. -
identifier: A single bind value, in a Rust variable.
SQL text:
?Abbreviated syntax for
(identifier). Equivalent to a call to [Builder.value()]. -
{expression}: A SQL fragment with any associated bind values.Expressionmust beBsql. (So&impl Bsqland&dyn Bsqlare allowed.)Equivalent to a call to [
Builder.fragment()]. -
[ARRAY CONTENTS …]: A Rust array as a SQL row value.SQL text:
(?,?,...)The array element type must be
ToSql + Sync. Useful with conditions like"VALUE IN (...)".Equivalent to a call to [
Builder.array_as_row_value()]. -
.METHOD(ARGUMENTS): CallBuilder::method. METHOD must be a method onBuilder. Typically:.insert_row(impl AsSqlRow).ref_iter_as_row_value(&impl Iterator<&impl ToSql + Sync>)
Methods available via method dispatch are also allowed, including ones in extension traits in scope. METHOD’s return value should be another
Builder, This is true ofBuilder’s inherent methods.Generics are not permitted and UFCS is not available. To append things other than via methods on
Builder, represent them as something that implementsBsql, and put that value in{ }inbsql!. To apply arbitrary transformations to the being-builtBsql, use the expansion ofbsql!as an expression.