From 6281b671ec1c72d3c522323e98fb6c52c88868e2 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 10 Apr 2019 20:11:26 -0400 Subject: [PATCH] playing with types a little --- src/lib.rs | 2 +- src/query_builder.rs | 5 +---- src/types.rs | 7 +++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 22ccccf..7f05abf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ //! //! A query builder using mostly strings, with methods following common SQL syntax #![warn(missing_docs)] - // Temporarily silence unused variables and uncalled code warnings // @TODO remove when most of the code is implemented #![allow(dead_code)] @@ -10,6 +9,7 @@ pub mod drivers; pub mod query_builder; +pub mod types; /// Split a string, apply a closure to each substring, /// then join the string back together diff --git a/src/query_builder.rs b/src/query_builder.rs index ab24aac..d9bec8b 100644 --- a/src/query_builder.rs +++ b/src/query_builder.rs @@ -1,14 +1,11 @@ //! Query Builder //! //! The QueryBuilder creates sql queries from chained methods -use std::any::Any; use std::collections::HashMap; use crate::drivers::{DatabaseDriver, DefaultDriver}; use crate::split_map_join; - -/// The Wild type is any type, until examined -pub type Wild = Box; +use crate::types::Wild; /// The position of the wildcard(s) /// for a `like` clause diff --git a/src/types.rs b/src/types.rs index 87ebf70..837aafd 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,12 +1,15 @@ //! Shared Types for different Database drivers use std::any::Any; +/// The Wild type is any type, until examined +pub type Wild = Box; + #[derive(Debug)] -pub struct Type(pub Box); +struct Type(pub Wild); /// Enum struct for mapping between database and Rust types #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] -pub enum SQLType { +enum SQLType { Boolean(T), SmallInt(T), BigInt(T),