1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
use std::fmt::Write; pub mod bind; pub use bind::Bind; pub mod field; pub use field::Field; pub trait Primative { fn write_primative(&self, sql: &mut String); } impl Primative for String { fn write_primative(&self, sql: &mut String) { sql.push('\''); sql.push_str(&self); sql.push('\''); } } impl Primative for &'_ str { fn write_primative(&self, sql: &mut String) { sql.push('\''); sql.push_str(self); sql.push('\''); } } impl Primative for i64 { fn write_primative(&self, sql: &mut String) { sql.write_fmt(format_args!("{}", self)).unwrap(); } }