pub struct SqlName { /* private fields */ }
Expand description
Create safe name of identifier
§Examples
#[macro_use] extern crate sql_builder;
use sql_builder::{SqlBuilder, SqlName};
let sql = SqlBuilder::select_from(SqlName::new("public").add("BOOKS").alias("b").baquoted())
.field(SqlName::new("b").add("title").baquoted())
.field(SqlName::new("s").add("total").baquoted())
.left()
.join(SqlName::new("shops").alias("s").baquoted())
.on_eq(SqlName::new("b").add("id").baquoted(), SqlName::new("s").add("book").baquoted())
.sql()?;
assert_eq!("SELECT `b`.`title`, `s`.`total` FROM `public`.`BOOKS` AS b LEFT JOIN `shops` AS s ON `b`.`id` = `s`.`book`;", &sql);
#[macro_use] extern crate sql_builder;
use sql_builder::{SqlBuilder, SqlName};
let sql = SqlBuilder::select_from(baname!("public", "BOOKS"; "b"))
.field(baname!("b", "title"))
.field(baname!("s", "total"))
.left()
.join(baname!("shops"; "s"))
.on_eq(baname!("b", "id"), baname!("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);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqlName
impl RefUnwindSafe for SqlName
impl Send for SqlName
impl Sync for SqlName
impl Unpin for SqlName
impl UnwindSafe for SqlName
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