1 //! The types in this module are all shorthand for `PredicateType<Lhs, 2 //! AsExpr<Rhs, Lhs>>`. Since we often need to return concrete types, instead of 3 //! a boxed trait object, these can be useful for writing concise return types. 4 use super::array_comparison::{AsInExpression, In, NotIn}; 5 use super::grouped::Grouped; 6 use super::{AsExpression, Expression}; 7 use sql_types; 8 9 /// The SQL type of an expression 10 pub type SqlTypeOf<Expr> = <Expr as Expression>::SqlType; 11 12 /// The type of `Item` when converted to an expression with the same type as `TargetExpr` 13 pub type AsExpr<Item, TargetExpr> = AsExprOf<Item, SqlTypeOf<TargetExpr>>; 14 15 /// The type of `Item` when converted to an expression of `Type` 16 pub type AsExprOf<Item, Type> = <Item as AsExpression<Type>>::Expression; 17 18 /// The return type of 19 /// [`lhs.eq(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.eq) 20 pub type Eq<Lhs, Rhs> = super::operators::Eq<Lhs, AsExpr<Rhs, Lhs>>; 21 22 /// The return type of 23 /// [`lhs.ne(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ne) 24 pub type NotEq<Lhs, Rhs> = super::operators::NotEq<Lhs, AsExpr<Rhs, Lhs>>; 25 26 /// The return type of 27 /// [`lhs.eq_any(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.eq_any) 28 pub type EqAny<Lhs, Rhs> = In<Lhs, <Rhs as AsInExpression<SqlTypeOf<Lhs>>>::InExpression>; 29 30 /// The return type of 31 /// [`lhs.ne_any(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ne_any) 32 pub type NeAny<Lhs, Rhs> = NotIn<Lhs, <Rhs as AsInExpression<SqlTypeOf<Lhs>>>::InExpression>; 33 34 /// The return type of 35 /// [`expr.is_null()`](../expression_methods/trait.ExpressionMethods.html#method.is_null) 36 pub type IsNull<Expr> = super::operators::IsNull<Expr>; 37 38 /// The return type of 39 /// [`expr.is_not_null()`](../expression_methods/trait.ExpressionMethods.html#method.is_not_null) 40 pub type IsNotNull<Expr> = super::operators::IsNotNull<Expr>; 41 42 /// The return type of 43 /// [`lhs.gt(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.gt) 44 pub type Gt<Lhs, Rhs> = super::operators::Gt<Lhs, AsExpr<Rhs, Lhs>>; 45 46 /// The return type of 47 /// [`lhs.ge(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.ge) 48 pub type GtEq<Lhs, Rhs> = super::operators::GtEq<Lhs, AsExpr<Rhs, Lhs>>; 49 50 /// The return type of 51 /// [`lhs.lt(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.lt) 52 pub type Lt<Lhs, Rhs> = super::operators::Lt<Lhs, AsExpr<Rhs, Lhs>>; 53 54 /// The return type of 55 /// [`lhs.le(rhs)`](../expression_methods/trait.ExpressionMethods.html#method.le) 56 pub type LtEq<Lhs, Rhs> = super::operators::LtEq<Lhs, AsExpr<Rhs, Lhs>>; 57 58 /// The return type of 59 /// [`lhs.between(lower, upper)`](../expression_methods/trait.ExpressionMethods.html#method.between) 60 pub type Between<Lhs, Lower, Upper> = 61 super::operators::Between<Lhs, super::operators::And<AsExpr<Lower, Lhs>, AsExpr<Upper, Lhs>>>; 62 63 /// The return type of 64 /// [`lhs.not_between(lower, upper)`](../expression_methods/trait.ExpressionMethods.html#method.not_between) 65 pub type NotBetween<Lhs, Lower, Upper> = super::operators::NotBetween< 66 Lhs, 67 super::operators::And<AsExpr<Lower, Lhs>, AsExpr<Upper, Lhs>>, 68 >; 69 70 /// The return type of 71 /// [`expr.desc()`](../expression_methods/trait.ExpressionMethods.html#method.desc) 72 pub type Desc<Expr> = super::operators::Desc<Expr>; 73 74 /// The return type of 75 /// [`expr.asc()`](../expression_methods/trait.ExpressionMethods.html#method.asc) 76 pub type Asc<Expr> = super::operators::Asc<Expr>; 77 78 /// The return type of 79 /// [`expr.nullable()`](../expression_methods/trait.NullableExpressionMethods.html#method.nullable) 80 pub type Nullable<Expr> = super::nullable::Nullable<Expr>; 81 82 /// The return type of 83 /// [`lhs.and(rhs)`](../expression_methods/trait.BoolExpressionMethods.html#method.and) 84 pub type And<Lhs, Rhs> = super::operators::And<Lhs, AsExprOf<Rhs, sql_types::Bool>>; 85 86 /// The return type of 87 /// [`lhs.or(rhs)`](../expression_methods/trait.BoolExpressionMethods.html#method.or) 88 pub type Or<Lhs, Rhs> = Grouped<super::operators::Or<Lhs, AsExprOf<Rhs, sql_types::Bool>>>; 89 90 /// The return type of 91 /// [`lhs.escape('x')`](../expression_methods/trait.EscapeExpressionMethods.html#method.escape) 92 pub type Escape<Lhs> = super::operators::Escape<Lhs, AsExprOf<String, sql_types::VarChar>>; 93 94 /// The return type of 95 /// [`lhs.like(rhs)`](../expression_methods/trait.TextExpressionMethods.html#method.like) 96 pub type Like<Lhs, Rhs> = super::operators::Like<Lhs, AsExprOf<Rhs, sql_types::VarChar>>; 97 98 /// The return type of 99 /// [`lhs.not_like(rhs)`](../expression_methods/trait.TextExpressionMethods.html#method.not_like) 100 pub type NotLike<Lhs, Rhs> = super::operators::NotLike<Lhs, AsExprOf<Rhs, sql_types::VarChar>>; 101 102 #[doc(inline)] 103 pub use super::functions::helper_types::*; 104