1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#![deny(missing_debug_implementations, missing_copy_implementations,
        warnings,
        trivial_numeric_casts,
        unstable_features,
        unused, future_incompatible)]

extern crate serde_json;
extern crate chrono;

#[cfg(feature = "postgres")]
extern crate postgres;
extern crate uuid;

mod prelude {
    pub use {
        ToIsPredicate,
        ToOrPredicate,
        ToAndPredicate,
        ToInPredicate,
        ToInRangePredicate,
        ToInequalityPredicate,
        ToExcludePredicate,
        ToLikePredicate,
        ToIsNullPredicate,
        Selectable,
        Queryable,
        Orderable,
        ToSelectQuery,
        Updatable,
        ToFieldUpdate,
        ToInsertValue,
        Deletable,
        ToExpression,
        ToListExpression
    };
}

pub use field::{
    Field,
    BoxedField,
    SharedField,
    NamedField,

    BoolField,
    I8Field,
    I16Field,
    I32Field,
    I64Field,
    F32Field,
    F64Field,
    StringField,
    ByteListField,
    JsonField,
    TimespecField,
    UuidField,

    OptionalBoolField,
    OptionalI8Field,
    OptionalI16Field,
    OptionalI32Field,
    OptionalI64Field,
    OptionalF32Field,
    OptionalF64Field,
    OptionalStringField,
    OptionalByteListField,
    OptionalJsonField,
    OptionalTimespecField,
    OptionalUuidField,
};

pub use predicate::{
    Predicate,
    SharedPredicate,
    IsPredicate, ToIsPredicate,
    OrPredicate, ToOrPredicate,
    AndPredicate, ToAndPredicate,
    InPredicate, ToInPredicate,
    InRangePredicate, ToInRangePredicate, InRangeBounds,
    InequalityPredicate, ToInequalityPredicate, Inequality,
    ExcludePredicate, ToExcludePredicate,
    LikePredicate, ToLikePredicate,
    IsNullPredicate, ToIsNullPredicate,
    RawPredicate
};

pub use select_query::{
    Selectable,
    Queryable,
    Orderable,
    SelectQuery,
    SharedSelectQuery,
    ToSelectQuery,
    Select,
    NoResult,
    LimitOne,
    LimitTwo,
    LimitMany
};

pub use update_query::{
    UpdateQuery,
    FieldUpdate,
    FieldUpd,
    Updatable,
    ToFieldUpdate,
};

pub use insert_query::{
    InsertQuery,
    Insertable,
    ToInsertValue,
    InsertValue,
};

pub use delete_query::{
    DeleteQuery,
    Deletable,
};

pub use expression::{
    BoxedExpression,
    UntypedExpression,
    Expression,
    SharedExpression,
    RawExpression,
    ListExpression,
    ToExpression,
    ToListExpression
};

pub use sql::{SqlContext, ToSql, QueryToSql, FromToSql, ToPredicateValue};
#[cfg(feature = "postgres")] pub use sql::AsPostgresValue;
pub use from::{TableDef, Table, BoxedTable, SharedTable, From, BoxedFrom, SharedFrom};

pub use function::{
    Sum, SumArg,
    Min, MinArg,
    Max, MaxArg,
    Avg, AvgArg,
    Count, CountArg,
    CountAll
};

pub use placeholder::Placeholder;

macro_rules! with_clone {
    ($slf: ident, $v:ident, $ex:expr) => ({
        let mut $v = $slf.clone();
        $ex;
        $v
    })
}

mod field;
mod predicate;
mod select_query;
#[macro_use]
mod insert_query;

#[macro_use]
mod delete_query;
mod update_query;
pub mod sql;
mod expression;
mod order_by;
mod from;
mod join;
mod distinct;
mod group_by;
mod function;
mod placeholder;