playing with types a little
This commit is contained in:
parent
7065357737
commit
6281b671ec
@ -2,7 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! A query builder using mostly strings, with methods following common SQL syntax
|
//! A query builder using mostly strings, with methods following common SQL syntax
|
||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
|
|
||||||
// Temporarily silence unused variables and uncalled code warnings
|
// Temporarily silence unused variables and uncalled code warnings
|
||||||
// @TODO remove when most of the code is implemented
|
// @TODO remove when most of the code is implemented
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
@ -10,6 +9,7 @@
|
|||||||
|
|
||||||
pub mod drivers;
|
pub mod drivers;
|
||||||
pub mod query_builder;
|
pub mod query_builder;
|
||||||
|
pub mod types;
|
||||||
|
|
||||||
/// Split a string, apply a closure to each substring,
|
/// Split a string, apply a closure to each substring,
|
||||||
/// then join the string back together
|
/// then join the string back together
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
//! Query Builder
|
//! Query Builder
|
||||||
//!
|
//!
|
||||||
//! The QueryBuilder creates sql queries from chained methods
|
//! The QueryBuilder creates sql queries from chained methods
|
||||||
use std::any::Any;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::drivers::{DatabaseDriver, DefaultDriver};
|
use crate::drivers::{DatabaseDriver, DefaultDriver};
|
||||||
use crate::split_map_join;
|
use crate::split_map_join;
|
||||||
|
use crate::types::Wild;
|
||||||
/// The Wild type is any type, until examined
|
|
||||||
pub type Wild = Box<dyn Any>;
|
|
||||||
|
|
||||||
/// The position of the wildcard(s)
|
/// The position of the wildcard(s)
|
||||||
/// for a `like` clause
|
/// for a `like` clause
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
//! Shared Types for different Database drivers
|
//! Shared Types for different Database drivers
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
|
/// The Wild type is any type, until examined
|
||||||
|
pub type Wild = Box<dyn Any>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Type(pub Box<dyn Any>);
|
struct Type(pub Wild);
|
||||||
|
|
||||||
/// Enum struct for mapping between database and Rust types
|
/// Enum struct for mapping between database and Rust types
|
||||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
|
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
|
||||||
pub enum SQLType<T> {
|
enum SQLType<T> {
|
||||||
Boolean(T),
|
Boolean(T),
|
||||||
SmallInt(T),
|
SmallInt(T),
|
||||||
BigInt(T),
|
BigInt(T),
|
||||||
|
Loading…
Reference in New Issue
Block a user