Prepwork for the type apocalypse
This commit is contained in:
parent
296e87e3e9
commit
9e4b483b2b
20
src/main.rs
20
src/main.rs
@ -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)));
|
|
||||||
}
|
|
@ -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
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user