Prepwork for the type apocalypse

This commit is contained in:
Timothy Warren 2019-04-16 16:26:55 -04:00
parent 296e87e3e9
commit 9e4b483b2b
2 changed files with 15 additions and 20 deletions

View File

@ -1,20 +0,0 @@
//! This main file is just for temparary testing
use stringqb::prelude::*;
fn main() {
let mut qb = QueryBuilder::new(PostgresDriver::new());
qb.set("foo", Box::new("bar"))
.set("bar", Box::new(12))
.set("baz", Box::new(false))
.set("fizz", Box::new(12.38))
.set("buzz", Box::new((1, 2.0, true, 'q')));
// This just makes me sad
qb.r#where("foo <>", Box::new(2));
println!("QueryBuilder object: {:#?}", &qb);
// println!("SQLType mapping: {:#?}", SQLType::SmallInt(32));
// println!("Type: {:#?}", Type(Box::new(1234567890)));
}

View File

@ -190,6 +190,16 @@ impl QueryBuilder {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/// Add a `having` clause to the query /// Add a `having` clause to the query
///
/// ```no_run
/// # use stringqb::prelude::*;
/// # let mut qb = QueryBuilder::default();
/// // By default, key = value
/// qb.having("key", vec![Box::new("value")]);
///
/// // Other operators can be used with a separating space
/// qb.having("clues >=", vec![Box::new(4)]);
/// ```
pub fn having(&mut self, key: &str, value: Vec<Box<dyn Any>>) -> &mut Self { pub fn having(&mut self, key: &str, value: Vec<Box<dyn Any>>) -> &mut Self {
self._having(key, value, "AND") self._having(key, value, "AND")
} }
@ -483,6 +493,11 @@ impl QueryBuilder {
self self
} }
/// Execute an SQL query
pub fn query(&mut self, sql: &str) {
unimplemented!();
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ! Implementation Details // ! Implementation Details
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------