[−][src]Struct sql_builder::name::SqlName
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
impl SqlName
[src]
pub fn new<S: ToString>(name: S) -> Self
[src]
Name of identifier
pub fn add<S: ToString>(&mut self, name: S) -> &mut Self
[src]
Add additional part of identifier
pub fn alias<S: ToString>(&mut self, alias: S) -> &mut Self
[src]
Set an alias for identifier
pub fn safe(&self) -> String
[src]
Make safe identifier
pub fn quoted(&self) -> String
[src]
Make quoted identifier
pub fn baquoted(&self) -> String
[src]
Make backquoted identifier
pub fn brquoted(&self) -> String
[src]
Make bracket-quoted identifier
pub fn dquoted(&self) -> String
[src]
Make double quoted identifier
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for SqlName
impl Send for SqlName
impl Sync for SqlName
impl Unpin for SqlName
impl UnwindSafe for SqlName
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,