Trait diesel::expression::AsExpression
[−]
[src]
pub trait AsExpression<T> { type Expression: Expression<SqlType = T>; fn as_expression(self) -> Self::Expression; }
Describes how a type can be represented as an expression for a given type.
These types couldn't just implement Expression
directly, as many things can be used as an expression of multiple types.
(String
for example, can be used as either
VarChar
or
Text
).
This trait allows us to use primitives on the right hand side of various
expressions. For example name.eq("Sean")
Associated Types
type Expression: Expression<SqlType = T>
Required Methods
fn as_expression(self) -> Self::Expression
Implementors
impl AsExpression<Timestamptz> for now type Expression = Coerce<now, Timestamptz>;
impl AsExpression<Nullable<Timestamptz>> for now type Expression = Coerce<now, Nullable<Timestamptz>>;
impl<T: Expression> AsExpression<T::SqlType> for T type Expression = Self;
impl<T, ST> AsExpression<Nullable<ST>> for Option<T> where
ST: NotNull, type Expression = Bound<Nullable<ST>, Self>;impl<'a, T, ST> AsExpression<Nullable<ST>> for &'a Option<T> where
ST: NotNull, type Expression = Bound<Nullable<ST>, Self>;impl<'a> AsExpression<Bool> for bool type Expression = Bound<Bool, Self>;
impl<'a, 'expr> AsExpression<Bool> for &'expr bool type Expression = Bound<Bool, Self>;
impl<'a> AsExpression<Nullable<Bool>> for bool type Expression = Bound<Nullable<Bool>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Bool>> for &'expr bool type Expression = Bound<Nullable<Bool>, Self>;
impl<'a> AsExpression<SmallInt> for i16 type Expression = Bound<SmallInt, Self>;
impl<'a, 'expr> AsExpression<SmallInt> for &'expr i16 type Expression = Bound<SmallInt, Self>;
impl<'a> AsExpression<Nullable<SmallInt>> for i16 type Expression = Bound<Nullable<SmallInt>, Self>;
impl<'a, 'expr> AsExpression<Nullable<SmallInt>> for &'expr i16 type Expression = Bound<Nullable<SmallInt>, Self>;
impl<'a> AsExpression<Integer> for i32 type Expression = Bound<Integer, Self>;
impl<'a, 'expr> AsExpression<Integer> for &'expr i32 type Expression = Bound<Integer, Self>;
impl<'a> AsExpression<Nullable<Integer>> for i32 type Expression = Bound<Nullable<Integer>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Integer>> for &'expr i32 type Expression = Bound<Nullable<Integer>, Self>;
impl<'a> AsExpression<BigInt> for i64 type Expression = Bound<BigInt, Self>;
impl<'a, 'expr> AsExpression<BigInt> for &'expr i64 type Expression = Bound<BigInt, Self>;
impl<'a> AsExpression<Nullable<BigInt>> for i64 type Expression = Bound<Nullable<BigInt>, Self>;
impl<'a, 'expr> AsExpression<Nullable<BigInt>> for &'expr i64 type Expression = Bound<Nullable<BigInt>, Self>;
impl<'a> AsExpression<Float> for f32 type Expression = Bound<Float, Self>;
impl<'a, 'expr> AsExpression<Float> for &'expr f32 type Expression = Bound<Float, Self>;
impl<'a> AsExpression<Nullable<Float>> for f32 type Expression = Bound<Nullable<Float>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Float>> for &'expr f32 type Expression = Bound<Nullable<Float>, Self>;
impl<'a> AsExpression<Double> for f64 type Expression = Bound<Double, Self>;
impl<'a, 'expr> AsExpression<Double> for &'expr f64 type Expression = Bound<Double, Self>;
impl<'a> AsExpression<Nullable<Double>> for f64 type Expression = Bound<Nullable<Double>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Double>> for &'expr f64 type Expression = Bound<Nullable<Double>, Self>;
impl<'a> AsExpression<Text> for String type Expression = Bound<Text, Self>;
impl<'a, 'expr> AsExpression<Text> for &'expr String type Expression = Bound<Text, Self>;
impl<'a> AsExpression<Nullable<Text>> for String type Expression = Bound<Nullable<Text>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Text>> for &'expr String type Expression = Bound<Nullable<Text>, Self>;
impl<'a> AsExpression<Binary> for Vec<u8> type Expression = Bound<Binary, Self>;
impl<'a, 'expr> AsExpression<Binary> for &'expr Vec<u8> type Expression = Bound<Binary, Self>;
impl<'a> AsExpression<Nullable<Binary>> for Vec<u8> type Expression = Bound<Nullable<Binary>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Binary>> for &'expr Vec<u8> type Expression = Bound<Nullable<Binary>, Self>;
impl<'a> AsExpression<Text> for &'a str type Expression = Bound<Text, Self>;
impl<'a, 'expr> AsExpression<Text> for &'expr &'a str type Expression = Bound<Text, Self>;
impl<'a> AsExpression<Nullable<Text>> for &'a str type Expression = Bound<Nullable<Text>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Text>> for &'expr &'a str type Expression = Bound<Nullable<Text>, Self>;
impl<'a> AsExpression<Binary> for &'a [u8] type Expression = Bound<Binary, Self>;
impl<'a, 'expr> AsExpression<Binary> for &'expr &'a [u8] type Expression = Bound<Binary, Self>;
impl<'a> AsExpression<Nullable<Binary>> for &'a [u8] type Expression = Bound<Nullable<Binary>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Binary>> for &'expr &'a [u8] type Expression = Bound<Nullable<Binary>, Self>;
impl<'a, T: ?Sized, ST> AsExpression<ST> for Cow<'a, T> where
T: 'a + ToOwned,
Bound<ST, Cow<'a, T>>: Expression<SqlType = ST>, type Expression = Bound<ST, Self>;impl<'a, 'b, T: ?Sized, ST> AsExpression<ST> for &'b Cow<'a, T> where
T: 'a + ToOwned,
&'b T: AsExpression<ST>, type Expression = <&'b T as AsExpression<ST>>::Expression;impl<'a, 'b, ST, T> AsExpression<Array<ST>> for &'a [T] where
Pg: HasSqlType<ST>, type Expression = Bound<Array<ST>, Self>;impl<'a, 'b, ST, T> AsExpression<Nullable<Array<ST>>> for &'a [T] where
Pg: HasSqlType<ST>, type Expression = Bound<Nullable<Array<ST>>, Self>;impl<'a, 'b, ST, T> AsExpression<Array<ST>> for &'a &'b [T] where
Pg: HasSqlType<ST>, type Expression = Bound<Array<ST>, Self>;impl<'a, 'b, ST, T> AsExpression<Nullable<Array<ST>>> for &'a &'b [T] where
Pg: HasSqlType<ST>, type Expression = Bound<Nullable<Array<ST>>, Self>;impl<'a, 'b, ST, T> AsExpression<Array<ST>> for Vec<T> where
Pg: HasSqlType<ST>, type Expression = Bound<Array<ST>, Self>;impl<'a, 'b, ST, T> AsExpression<Nullable<Array<ST>>> for Vec<T> where
Pg: HasSqlType<ST>, type Expression = Bound<Nullable<Array<ST>>, Self>;impl<'a, 'b, ST, T> AsExpression<Array<ST>> for &'a Vec<T> where
Pg: HasSqlType<ST>, type Expression = Bound<Array<ST>, Self>;impl<'a, 'b, ST, T> AsExpression<Nullable<Array<ST>>> for &'a Vec<T> where
Pg: HasSqlType<ST>, type Expression = Bound<Nullable<Array<ST>>, Self>;impl<ST, T> AsExpression<Range<ST>> for (Bound<T>, Bound<T>) where
Pg: HasSqlType<ST> + HasSqlType<Range<ST>>, type Expression = SqlBound<Range<ST>, Self>;impl<'a, ST, T> AsExpression<Range<ST>> for &'a (Bound<T>, Bound<T>) where
Pg: HasSqlType<ST> + HasSqlType<Range<ST>>, type Expression = SqlBound<Range<ST>, Self>;impl<ST, T> AsExpression<Nullable<Range<ST>>> for (Bound<T>, Bound<T>) where
Pg: HasSqlType<ST> + HasSqlType<Range<ST>>, type Expression = SqlBound<Nullable<Range<ST>>, Self>;impl<'a, ST, T> AsExpression<Nullable<Range<ST>>> for &'a (Bound<T>, Bound<T>) where
Pg: HasSqlType<ST> + HasSqlType<Range<ST>>, type Expression = SqlBound<Nullable<Range<ST>>, Self>;impl<'a> AsExpression<Timestamp> for SystemTime type Expression = Bound<Timestamp, Self>;
impl<'a, 'expr> AsExpression<Timestamp> for &'expr SystemTime type Expression = Bound<Timestamp, Self>;
impl<'a> AsExpression<Nullable<Timestamp>> for SystemTime type Expression = Bound<Nullable<Timestamp>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Timestamp>> for &'expr SystemTime type Expression = Bound<Nullable<Timestamp>, Self>;
impl<'a> AsExpression<Date> for PgDate type Expression = Bound<Date, Self>;
impl<'a, 'expr> AsExpression<Date> for &'expr PgDate type Expression = Bound<Date, Self>;
impl<'a> AsExpression<Nullable<Date>> for PgDate type Expression = Bound<Nullable<Date>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Date>> for &'expr PgDate type Expression = Bound<Nullable<Date>, Self>;
impl<'a> AsExpression<Time> for PgTime type Expression = Bound<Time, Self>;
impl<'a, 'expr> AsExpression<Time> for &'expr PgTime type Expression = Bound<Time, Self>;
impl<'a> AsExpression<Nullable<Time>> for PgTime type Expression = Bound<Nullable<Time>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Time>> for &'expr PgTime type Expression = Bound<Nullable<Time>, Self>;
impl<'a> AsExpression<Timestamp> for PgTimestamp type Expression = Bound<Timestamp, Self>;
impl<'a, 'expr> AsExpression<Timestamp> for &'expr PgTimestamp type Expression = Bound<Timestamp, Self>;
impl<'a> AsExpression<Nullable<Timestamp>> for PgTimestamp type Expression = Bound<Nullable<Timestamp>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Timestamp>> for &'expr PgTimestamp type Expression = Bound<Nullable<Timestamp>, Self>;
impl<'a> AsExpression<Timestamptz> for PgTimestamp type Expression = Bound<Timestamptz, Self>;
impl<'a, 'expr> AsExpression<Timestamptz> for &'expr PgTimestamp type Expression = Bound<Timestamptz, Self>;
impl<'a> AsExpression<Nullable<Timestamptz>> for PgTimestamp type Expression = Bound<Nullable<Timestamptz>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Timestamptz>> for &'expr PgTimestamp type Expression = Bound<Nullable<Timestamptz>, Self>;
impl<'a> AsExpression<Interval> for PgInterval type Expression = Bound<Interval, Self>;
impl<'a, 'expr> AsExpression<Interval> for &'expr PgInterval type Expression = Bound<Interval, Self>;
impl<'a> AsExpression<Nullable<Interval>> for PgInterval type Expression = Bound<Nullable<Interval>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Interval>> for &'expr PgInterval type Expression = Bound<Nullable<Interval>, Self>;
impl<'a> AsExpression<Oid> for u32 type Expression = Bound<Oid, Self>;
impl<'a, 'expr> AsExpression<Oid> for &'expr u32 type Expression = Bound<Oid, Self>;
impl<'a> AsExpression<Nullable<Oid>> for u32 type Expression = Bound<Nullable<Oid>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Oid>> for &'expr u32 type Expression = Bound<Nullable<Oid>, Self>;
impl<'a> AsExpression<Numeric> for PgNumeric type Expression = Bound<Numeric, Self>;
impl<'a, 'expr> AsExpression<Numeric> for &'expr PgNumeric type Expression = Bound<Numeric, Self>;
impl<'a> AsExpression<Nullable<Numeric>> for PgNumeric type Expression = Bound<Nullable<Numeric>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Numeric>> for &'expr PgNumeric type Expression = Bound<Nullable<Numeric>, Self>;
impl<'a> AsExpression<Money> for PgMoney type Expression = Bound<Money, Self>;
impl<'a, 'expr> AsExpression<Money> for &'expr PgMoney type Expression = Bound<Money, Self>;
impl<'a> AsExpression<Nullable<Money>> for PgMoney type Expression = Bound<Nullable<Money>, Self>;
impl<'a, 'expr> AsExpression<Nullable<Money>> for &'expr PgMoney type Expression = Bound<Nullable<Money>, Self>;