Hide more things

This commit is contained in:
Timothy Warren 2019-04-17 12:01:46 -04:00
parent 9a1073aae2
commit dc28318a3f
3 changed files with 68 additions and 67 deletions

View File

@ -1,63 +0,0 @@
//! Common enums
/// The position of the wildcard(s)
/// for a `like` clause
#[derive(Debug)]
pub enum LikeWildcard {
/// Wildcard before search term
/// eg. `%foo`
Before,
/// Wildcard after the search term
/// eg. `foo%`
After,
/// Wildcards surrounding the search term
/// eg. `%foo%`
Both,
}
/// The type of SQL join
#[derive(Debug)]
pub enum JoinType {
/// A `CROSS` join
Cross,
/// An `INNER` join
Inner,
/// An `OUTER` join
Outer,
/// A `LEFT (OUTER)` join
Left,
/// A `RIGHT (OUTER)` join
Right,
}
/// The sort direction
#[derive(Debug, PartialEq)]
pub enum OrderDirection {
/// Sort Ascending
Asc,
/// Sort Descending
Desc,
/// Random Sort (Not yet implemented!)
Rand,
}
/// The type of Query Clause
#[derive(Debug, PartialEq)]
pub enum QueryClauseType {
/// Ending a parenthetical grouping
GroupEnd,
/// Starting a parenthetical grouping
GroupStart,
/// A having clause
Having,
/// A join clause
Join,
/// A like clause
Like,
/// A where clause
Where,
/// A where in clause
WhereIn,
}

View File

@ -17,7 +17,6 @@
extern crate lazy_static; extern crate lazy_static;
pub mod drivers; pub mod drivers;
pub mod enums;
pub mod fns; pub mod fns;
pub mod query_builder; pub mod query_builder;
@ -27,8 +26,12 @@ pub mod prelude {
//! This includes enum types, traits, //! This includes enum types, traits,
//! the Query Builder, and individual database drivers. //! the Query Builder, and individual database drivers.
pub use crate::drivers::DatabaseDriver; pub use crate::drivers::DatabaseDriver;
pub use crate::enums::*; pub use crate::query_builder::{
pub use crate::query_builder::QueryBuilder; LikeWildcard,
JoinType,
OrderDirection,
QueryBuilder
};
#[cfg(feature = "postgres")] #[cfg(feature = "postgres")]
/// Postgres Driver /// Postgres Driver

View File

@ -5,11 +5,72 @@ use std::any::Any;
use std::collections::HashMap; use std::collections::HashMap;
use crate::drivers::{DatabaseDriver, DefaultDriver}; use crate::drivers::{DatabaseDriver, DefaultDriver};
use crate::enums::*;
use crate::fns::split_map_join; use crate::fns::split_map_join;
use regex::Regex; use regex::Regex;
/// The position of the wildcard(s)
/// for a `like` clause
#[derive(Debug)]
pub enum LikeWildcard {
/// Wildcard before search term
/// eg. `%foo`
Before,
/// Wildcard after the search term
/// eg. `foo%`
After,
/// Wildcards surrounding the search term
/// eg. `%foo%`
Both,
}
/// The type of SQL join
#[derive(Debug)]
pub enum JoinType {
/// A `CROSS` join
Cross,
/// An `INNER` join
Inner,
/// An `OUTER` join
Outer,
/// A `LEFT (OUTER)` join
Left,
/// A `RIGHT (OUTER)` join
Right,
}
/// The sort direction
#[derive(Debug, PartialEq)]
pub enum OrderDirection {
/// Sort Ascending
Asc,
/// Sort Descending
Desc,
/// Random Sort (Not yet implemented!)
Rand,
}
/// The type of Query Clause
#[derive(Debug, PartialEq)]
enum QueryClauseType {
/// Ending a parenthetical grouping
GroupEnd,
/// Starting a parenthetical grouping
GroupStart,
/// A having clause
Having,
/// A join clause
Join,
/// A like clause
Like,
/// A where clause
Where,
/// A where in clause
WhereIn,
}
#[derive(Debug)] #[derive(Debug)]
enum QueryType { enum QueryType {
Select, Select,