[−][src]Trait diesel::expression::AsExpression
Converts a type to its representation for use in Diesel's query builder.
This trait is used directly. Apps should typically use IntoSql instead.
Implementations of this trait will generally do one of 3 things:
-
Return
selffor types which are already parts of Diesel's query builder -
Perform some implicit coercion (for example, allowing
nowto be used as bothTimestampandTimestamptz. -
Indicate that the type has data which will be sent separately from the query. This is generally referred as a "bind parameter". Types which implement
ToSqlwill generally implementAsExpressionthis way.
Deriving
This trait can be automatically derived for any type which implements ToSql.
The type must be annotated with #[sql_type = "SomeType"].
If that annotation appears multiple times,
implementations will be generated for each one of them.
This will generate the following impls:
impl AsExpression<SqlType> for YourTypeimpl AsExpression<Nullable<SqlType>> for YourTypeimpl AsExpression<SqlType> for &'a YourTypeimpl AsExpression<Nullable<SqlType>> for &'a YourTypeimpl AsExpression<SqlType> for &'a &'b YourTypeimpl AsExpression<Nullable<SqlType>> for &'a &'b YourType
If your type is unsized,
you can specify this by adding the annotation #[diesel(not_sized)].
This will skip the impls for non-reference types.
Associated Types
type Expression: Expression<SqlType = T>
The expression being returned
Required methods
fn as_expression(self) -> Self::Expression
Perform the conversion
Implementations on Foreign Types
impl<'expr> AsExpression<Timestamp> for &'expr SystemTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Timestamp>> for &'expr SystemTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Timestamp> for &'expr2 &'expr SystemTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Timestamp>> for &'expr2 &'expr SystemTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Timestamp> for SystemTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Timestamp>> for SystemTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Date> for &'expr NaiveDate[src]
type Expression = Bound<Date, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Date>> for &'expr NaiveDate[src]
type Expression = Bound<Nullable<Date>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Date> for &'expr2 &'expr NaiveDate[src]
type Expression = Bound<Date, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Date>> for &'expr2 &'expr NaiveDate[src]
type Expression = Bound<Nullable<Date>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Date> for NaiveDate[src]
type Expression = Bound<Date, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Date>> for NaiveDate[src]
type Expression = Bound<Nullable<Date>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Time> for &'expr NaiveTime[src]
type Expression = Bound<Time, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Time>> for &'expr NaiveTime[src]
type Expression = Bound<Nullable<Time>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Time> for &'expr2 &'expr NaiveTime[src]
type Expression = Bound<Time, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Time>> for &'expr2 &'expr NaiveTime[src]
type Expression = Bound<Nullable<Time>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Time> for NaiveTime[src]
type Expression = Bound<Time, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Time>> for NaiveTime[src]
type Expression = Bound<Nullable<Time>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Timestamp> for &'expr NaiveDateTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Timestamp>> for &'expr NaiveDateTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Timestamp> for &'expr2 &'expr NaiveDateTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Timestamp>> for &'expr2 &'expr NaiveDateTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Timestamp> for NaiveDateTime[src]
type Expression = Bound<Timestamp, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Timestamp>> for NaiveDateTime[src]
type Expression = Bound<Nullable<Timestamp>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Datetime> for &'expr NaiveDateTime[src]
type Expression = Bound<Datetime, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Datetime>> for &'expr NaiveDateTime[src]
type Expression = Bound<Nullable<Datetime>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Datetime> for &'expr2 &'expr NaiveDateTime[src]
type Expression = Bound<Datetime, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Datetime>> for &'expr2 &'expr NaiveDateTime[src]
type Expression = Bound<Nullable<Datetime>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Datetime> for NaiveDateTime[src]
type Expression = Bound<Datetime, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Datetime>> for NaiveDateTime[src]
type Expression = Bound<Nullable<Datetime>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<T, ST> AsExpression<Nullable<ST>> for Option<T> where
ST: NotNull, [src]
ST: NotNull,
type Expression = Bound<Nullable<ST>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'a, T, ST> AsExpression<Nullable<ST>> for &'a Option<T> where
ST: NotNull, [src]
ST: NotNull,
type Expression = Bound<Nullable<ST>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Bool> for &'expr bool[src]
type Expression = Bound<Bool, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Bool>> for &'expr bool[src]
type Expression = Bound<Nullable<Bool>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Bool> for &'expr2 &'expr bool[src]
type Expression = Bound<Bool, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Bool>> for &'expr2 &'expr bool[src]
type Expression = Bound<Nullable<Bool>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Bool> for bool[src]
type Expression = Bound<Bool, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Bool>> for bool[src]
type Expression = Bound<Nullable<Bool>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<TinyInt> for &'expr i8[src]
type Expression = Bound<TinyInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<TinyInt>> for &'expr i8[src]
type Expression = Bound<Nullable<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<TinyInt> for &'expr2 &'expr i8[src]
type Expression = Bound<TinyInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<TinyInt>> for &'expr2 &'expr i8[src]
type Expression = Bound<Nullable<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<TinyInt> for i8[src]
type Expression = Bound<TinyInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<TinyInt>> for i8[src]
type Expression = Bound<Nullable<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<SmallInt> for &'expr i16[src]
type Expression = Bound<SmallInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<SmallInt>> for &'expr i16[src]
type Expression = Bound<Nullable<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<SmallInt> for &'expr2 &'expr i16[src]
type Expression = Bound<SmallInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<SmallInt>> for &'expr2 &'expr i16[src]
type Expression = Bound<Nullable<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<SmallInt> for i16[src]
type Expression = Bound<SmallInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<SmallInt>> for i16[src]
type Expression = Bound<Nullable<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Integer> for &'expr i32[src]
type Expression = Bound<Integer, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Integer>> for &'expr i32[src]
type Expression = Bound<Nullable<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Integer> for &'expr2 &'expr i32[src]
type Expression = Bound<Integer, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Integer>> for &'expr2 &'expr i32[src]
type Expression = Bound<Nullable<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Integer> for i32[src]
type Expression = Bound<Integer, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Integer>> for i32[src]
type Expression = Bound<Nullable<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<BigInt> for &'expr i64[src]
type Expression = Bound<BigInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<BigInt>> for &'expr i64[src]
type Expression = Bound<Nullable<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<BigInt> for &'expr2 &'expr i64[src]
type Expression = Bound<BigInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<BigInt>> for &'expr2 &'expr i64[src]
type Expression = Bound<Nullable<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<BigInt> for i64[src]
type Expression = Bound<BigInt, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<BigInt>> for i64[src]
type Expression = Bound<Nullable<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Unsigned<TinyInt>> for &'expr u8[src]
type Expression = Bound<Unsigned<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Unsigned<TinyInt>>> for &'expr u8[src]
type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Unsigned<TinyInt>> for &'expr2 &'expr u8[src]
type Expression = Bound<Unsigned<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<TinyInt>>> for &'expr2 &'expr u8[src]
type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Unsigned<TinyInt>> for u8[src]
type Expression = Bound<Unsigned<TinyInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Unsigned<TinyInt>>> for u8[src]
type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Unsigned<SmallInt>> for &'expr u16[src]
type Expression = Bound<Unsigned<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Unsigned<SmallInt>>> for &'expr u16[src]
type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Unsigned<SmallInt>> for &'expr2 &'expr u16[src]
type Expression = Bound<Unsigned<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<SmallInt>>> for &'expr2 &'expr u16[src]
type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Unsigned<SmallInt>> for u16[src]
type Expression = Bound<Unsigned<SmallInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Unsigned<SmallInt>>> for u16[src]
type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Unsigned<Integer>> for &'expr u32[src]
type Expression = Bound<Unsigned<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Unsigned<Integer>>> for &'expr u32[src]
type Expression = Bound<Nullable<Unsigned<Integer>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Unsigned<Integer>> for &'expr2 &'expr u32[src]
type Expression = Bound<Unsigned<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<Integer>>> for &'expr2 &'expr u32[src]
type Expression = Bound<Nullable<Unsigned<Integer>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Unsigned<Integer>> for u32[src]
type Expression = Bound<Unsigned<Integer>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Unsigned<Integer>>> for u32[src]
type Expression = Bound<Nullable<Unsigned<Integer>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Unsigned<BigInt>> for &'expr u64[src]
type Expression = Bound<Unsigned<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Unsigned<BigInt>>> for &'expr u64[src]
type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Unsigned<BigInt>> for &'expr2 &'expr u64[src]
type Expression = Bound<Unsigned<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<BigInt>>> for &'expr2 &'expr u64[src]
type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Unsigned<BigInt>> for u64[src]
type Expression = Bound<Unsigned<BigInt>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Unsigned<BigInt>>> for u64[src]
type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Float> for &'expr f32[src]
type Expression = Bound<Float, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Float>> for &'expr f32[src]
type Expression = Bound<Nullable<Float>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Float> for &'expr2 &'expr f32[src]
type Expression = Bound<Float, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Float>> for &'expr2 &'expr f32[src]
type Expression = Bound<Nullable<Float>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Float> for f32[src]
type Expression = Bound<Float, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Float>> for f32[src]
type Expression = Bound<Nullable<Float>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Double> for &'expr f64[src]
type Expression = Bound<Double, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Double>> for &'expr f64[src]
type Expression = Bound<Nullable<Double>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Double> for &'expr2 &'expr f64[src]
type Expression = Bound<Double, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Double>> for &'expr2 &'expr f64[src]
type Expression = Bound<Nullable<Double>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Double> for f64[src]
type Expression = Bound<Double, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Double>> for f64[src]
type Expression = Bound<Nullable<Double>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Text> for &'expr String[src]
type Expression = Bound<Text, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Text>> for &'expr String[src]
type Expression = Bound<Nullable<Text>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Text> for &'expr2 &'expr String[src]
type Expression = Bound<Text, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Text>> for &'expr2 &'expr String[src]
type Expression = Bound<Nullable<Text>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Text> for String[src]
type Expression = Bound<Text, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Text>> for String[src]
type Expression = Bound<Nullable<Text>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Text> for &'expr str[src]
type Expression = Bound<Text, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Text>> for &'expr str[src]
type Expression = Bound<Nullable<Text>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Text> for &'expr2 &'expr str[src]
type Expression = Bound<Text, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Text>> for &'expr2 &'expr str[src]
type Expression = Bound<Nullable<Text>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Binary> for &'expr Vec<u8>[src]
type Expression = Bound<Binary, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Binary>> for &'expr Vec<u8>[src]
type Expression = Bound<Nullable<Binary>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Binary> for &'expr2 &'expr Vec<u8>[src]
type Expression = Bound<Binary, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Binary>> for &'expr2 &'expr Vec<u8>[src]
type Expression = Bound<Nullable<Binary>, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Binary> for Vec<u8>[src]
type Expression = Bound<Binary, Self>
fn as_expression(self) -> Self::Expression[src]
impl AsExpression<Nullable<Binary>> for Vec<u8>[src]
type Expression = Bound<Nullable<Binary>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Binary> for &'expr [u8][src]
type Expression = Bound<Binary, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr> AsExpression<Nullable<Binary>> for &'expr [u8][src]
type Expression = Bound<Nullable<Binary>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Binary> for &'expr2 &'expr [u8][src]
type Expression = Bound<Binary, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'expr2, 'expr> AsExpression<Nullable<Binary>> for &'expr2 &'expr [u8][src]
type Expression = Bound<Nullable<Binary>, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'a, T: ?Sized, ST> AsExpression<ST> for Cow<'a, T> where
T: 'a + ToOwned,
Bound<ST, Cow<'a, T>>: Expression<SqlType = ST>, [src]
T: 'a + ToOwned,
Bound<ST, Cow<'a, T>>: Expression<SqlType = ST>,
type Expression = Bound<ST, Self>
fn as_expression(self) -> Self::Expression[src]
impl<'a, 'b, T: ?Sized, ST> AsExpression<ST> for &'b Cow<'a, T> where
T: 'a + ToOwned,
Bound<ST, &'b T>: Expression<SqlType = ST>, [src]
T: 'a + ToOwned,
Bound<ST, &'b T>: Expression<SqlType = ST>,