macro_rules! brname {
( $n:expr ) => { ... };
( $n:expr, $( $x:expr ),* ) => { ... };
( $n:expr; $a:expr ) => { ... };
( $n:expr, $( $x:expr ),*; $a:expr ) => { ... };
}
Expand description
Make brackets quoted name of identifier.
ยงExamples
#[macro_use] extern crate sql_builder;
use sql_builder::{SqlBuilder, SqlName};
let sql = SqlBuilder::select_from(brname!("public", "BOOKS"; "b"))
.field(brname!("b", "title"))
.field(brname!("s", "total"))
.left()
.join(brname!("shops"; "s"))
.on_eq(brname!("b", "id"), brname!("s", "book"))
.sql()?;
assert_eq!("SELECT [b].[title], [s].[total] FROM [public].[BOOKS] AS b LEFT JOIN [shops] AS s ON [b].[id] = [s].[book];", &sql);