[][src]Trait diesel::expression::AsExpression

pub trait AsExpression<T> {
    type Expression: Expression<SqlType = T>;
    fn as_expression(self) -> Self::Expression;
}

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:

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:

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

Loading content...

Required methods

fn as_expression(self) -> Self::Expression

Perform the conversion

Loading content...

Implementations on Foreign Types

impl<'expr> AsExpression<Timestamp> for &'expr SystemTime[src]

type Expression = Bound<Timestamp, Self>

impl<'expr> AsExpression<Nullable<Timestamp>> for &'expr SystemTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl<'expr2, 'expr> AsExpression<Timestamp> for &'expr2 &'expr SystemTime[src]

type Expression = Bound<Timestamp, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Timestamp>> for &'expr2 &'expr SystemTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl AsExpression<Timestamp> for SystemTime[src]

type Expression = Bound<Timestamp, Self>

impl AsExpression<Nullable<Timestamp>> for SystemTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl<'expr> AsExpression<Date> for &'expr NaiveDate[src]

type Expression = Bound<Date, Self>

impl<'expr> AsExpression<Nullable<Date>> for &'expr NaiveDate[src]

type Expression = Bound<Nullable<Date>, Self>

impl<'expr2, 'expr> AsExpression<Date> for &'expr2 &'expr NaiveDate[src]

type Expression = Bound<Date, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Date>> for &'expr2 &'expr NaiveDate[src]

type Expression = Bound<Nullable<Date>, Self>

impl AsExpression<Date> for NaiveDate[src]

type Expression = Bound<Date, Self>

impl AsExpression<Nullable<Date>> for NaiveDate[src]

type Expression = Bound<Nullable<Date>, Self>

impl<'expr> AsExpression<Time> for &'expr NaiveTime[src]

type Expression = Bound<Time, Self>

impl<'expr> AsExpression<Nullable<Time>> for &'expr NaiveTime[src]

type Expression = Bound<Nullable<Time>, Self>

impl<'expr2, 'expr> AsExpression<Time> for &'expr2 &'expr NaiveTime[src]

type Expression = Bound<Time, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Time>> for &'expr2 &'expr NaiveTime[src]

type Expression = Bound<Nullable<Time>, Self>

impl AsExpression<Time> for NaiveTime[src]

type Expression = Bound<Time, Self>

impl AsExpression<Nullable<Time>> for NaiveTime[src]

type Expression = Bound<Nullable<Time>, Self>

impl<'expr> AsExpression<Timestamp> for &'expr NaiveDateTime[src]

type Expression = Bound<Timestamp, Self>

impl<'expr> AsExpression<Nullable<Timestamp>> for &'expr NaiveDateTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl<'expr2, 'expr> AsExpression<Timestamp> for &'expr2 &'expr NaiveDateTime[src]

type Expression = Bound<Timestamp, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Timestamp>> for &'expr2 &'expr NaiveDateTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl AsExpression<Timestamp> for NaiveDateTime[src]

type Expression = Bound<Timestamp, Self>

impl AsExpression<Nullable<Timestamp>> for NaiveDateTime[src]

type Expression = Bound<Nullable<Timestamp>, Self>

impl<'expr> AsExpression<Datetime> for &'expr NaiveDateTime[src]

type Expression = Bound<Datetime, Self>

impl<'expr> AsExpression<Nullable<Datetime>> for &'expr NaiveDateTime[src]

type Expression = Bound<Nullable<Datetime>, Self>

impl<'expr2, 'expr> AsExpression<Datetime> for &'expr2 &'expr NaiveDateTime[src]

type Expression = Bound<Datetime, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Datetime>> for &'expr2 &'expr NaiveDateTime[src]

type Expression = Bound<Nullable<Datetime>, Self>

impl AsExpression<Datetime> for NaiveDateTime[src]

type Expression = Bound<Datetime, Self>

impl AsExpression<Nullable<Datetime>> for NaiveDateTime[src]

type Expression = Bound<Nullable<Datetime>, Self>

impl<T, ST> AsExpression<Nullable<ST>> for Option<T> where
    ST: NotNull
[src]

type Expression = Bound<Nullable<ST>, Self>

impl<'a, T, ST> AsExpression<Nullable<ST>> for &'a Option<T> where
    ST: NotNull
[src]

type Expression = Bound<Nullable<ST>, Self>

impl<'expr> AsExpression<Bool> for &'expr bool[src]

type Expression = Bound<Bool, Self>

impl<'expr> AsExpression<Nullable<Bool>> for &'expr bool[src]

type Expression = Bound<Nullable<Bool>, Self>

impl<'expr2, 'expr> AsExpression<Bool> for &'expr2 &'expr bool[src]

type Expression = Bound<Bool, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Bool>> for &'expr2 &'expr bool[src]

type Expression = Bound<Nullable<Bool>, Self>

impl AsExpression<Bool> for bool[src]

type Expression = Bound<Bool, Self>

impl AsExpression<Nullable<Bool>> for bool[src]

type Expression = Bound<Nullable<Bool>, Self>

impl<'expr> AsExpression<TinyInt> for &'expr i8[src]

type Expression = Bound<TinyInt, Self>

impl<'expr> AsExpression<Nullable<TinyInt>> for &'expr i8[src]

type Expression = Bound<Nullable<TinyInt>, Self>

impl<'expr2, 'expr> AsExpression<TinyInt> for &'expr2 &'expr i8[src]

type Expression = Bound<TinyInt, Self>

impl<'expr2, 'expr> AsExpression<Nullable<TinyInt>> for &'expr2 &'expr i8[src]

type Expression = Bound<Nullable<TinyInt>, Self>

impl AsExpression<TinyInt> for i8[src]

type Expression = Bound<TinyInt, Self>

impl AsExpression<Nullable<TinyInt>> for i8[src]

type Expression = Bound<Nullable<TinyInt>, Self>

impl<'expr> AsExpression<SmallInt> for &'expr i16[src]

type Expression = Bound<SmallInt, Self>

impl<'expr> AsExpression<Nullable<SmallInt>> for &'expr i16[src]

type Expression = Bound<Nullable<SmallInt>, Self>

impl<'expr2, 'expr> AsExpression<SmallInt> for &'expr2 &'expr i16[src]

type Expression = Bound<SmallInt, Self>

impl<'expr2, 'expr> AsExpression<Nullable<SmallInt>> for &'expr2 &'expr i16[src]

type Expression = Bound<Nullable<SmallInt>, Self>

impl AsExpression<SmallInt> for i16[src]

type Expression = Bound<SmallInt, Self>

impl AsExpression<Nullable<SmallInt>> for i16[src]

type Expression = Bound<Nullable<SmallInt>, Self>

impl<'expr> AsExpression<Integer> for &'expr i32[src]

type Expression = Bound<Integer, Self>

impl<'expr> AsExpression<Nullable<Integer>> for &'expr i32[src]

type Expression = Bound<Nullable<Integer>, Self>

impl<'expr2, 'expr> AsExpression<Integer> for &'expr2 &'expr i32[src]

type Expression = Bound<Integer, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Integer>> for &'expr2 &'expr i32[src]

type Expression = Bound<Nullable<Integer>, Self>

impl AsExpression<Integer> for i32[src]

type Expression = Bound<Integer, Self>

impl AsExpression<Nullable<Integer>> for i32[src]

type Expression = Bound<Nullable<Integer>, Self>

impl<'expr> AsExpression<BigInt> for &'expr i64[src]

type Expression = Bound<BigInt, Self>

impl<'expr> AsExpression<Nullable<BigInt>> for &'expr i64[src]

type Expression = Bound<Nullable<BigInt>, Self>

impl<'expr2, 'expr> AsExpression<BigInt> for &'expr2 &'expr i64[src]

type Expression = Bound<BigInt, Self>

impl<'expr2, 'expr> AsExpression<Nullable<BigInt>> for &'expr2 &'expr i64[src]

type Expression = Bound<Nullable<BigInt>, Self>

impl AsExpression<BigInt> for i64[src]

type Expression = Bound<BigInt, Self>

impl AsExpression<Nullable<BigInt>> for i64[src]

type Expression = Bound<Nullable<BigInt>, Self>

impl<'expr> AsExpression<Unsigned<TinyInt>> for &'expr u8[src]

type Expression = Bound<Unsigned<TinyInt>, Self>

impl<'expr> AsExpression<Nullable<Unsigned<TinyInt>>> for &'expr u8[src]

type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>

impl<'expr2, 'expr> AsExpression<Unsigned<TinyInt>> for &'expr2 &'expr u8[src]

type Expression = Bound<Unsigned<TinyInt>, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<TinyInt>>> for &'expr2 &'expr u8[src]

type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>

impl AsExpression<Unsigned<TinyInt>> for u8[src]

type Expression = Bound<Unsigned<TinyInt>, Self>

impl AsExpression<Nullable<Unsigned<TinyInt>>> for u8[src]

type Expression = Bound<Nullable<Unsigned<TinyInt>>, Self>

impl<'expr> AsExpression<Unsigned<SmallInt>> for &'expr u16[src]

type Expression = Bound<Unsigned<SmallInt>, Self>

impl<'expr> AsExpression<Nullable<Unsigned<SmallInt>>> for &'expr u16[src]

type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>

impl<'expr2, 'expr> AsExpression<Unsigned<SmallInt>> for &'expr2 &'expr u16[src]

type Expression = Bound<Unsigned<SmallInt>, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<SmallInt>>> for &'expr2 &'expr u16[src]

type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>

impl AsExpression<Unsigned<SmallInt>> for u16[src]

type Expression = Bound<Unsigned<SmallInt>, Self>

impl AsExpression<Nullable<Unsigned<SmallInt>>> for u16[src]

type Expression = Bound<Nullable<Unsigned<SmallInt>>, Self>

impl<'expr> AsExpression<Unsigned<Integer>> for &'expr u32[src]

type Expression = Bound<Unsigned<Integer>, Self>

impl<'expr> AsExpression<Nullable<Unsigned<Integer>>> for &'expr u32[src]

type Expression = Bound<Nullable<Unsigned<Integer>>, Self>

impl<'expr2, 'expr> AsExpression<Unsigned<Integer>> for &'expr2 &'expr u32[src]

type Expression = Bound<Unsigned<Integer>, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<Integer>>> for &'expr2 &'expr u32[src]

type Expression = Bound<Nullable<Unsigned<Integer>>, Self>

impl AsExpression<Unsigned<Integer>> for u32[src]

type Expression = Bound<Unsigned<Integer>, Self>

impl AsExpression<Nullable<Unsigned<Integer>>> for u32[src]

type Expression = Bound<Nullable<Unsigned<Integer>>, Self>

impl<'expr> AsExpression<Unsigned<BigInt>> for &'expr u64[src]

type Expression = Bound<Unsigned<BigInt>, Self>

impl<'expr> AsExpression<Nullable<Unsigned<BigInt>>> for &'expr u64[src]

type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>

impl<'expr2, 'expr> AsExpression<Unsigned<BigInt>> for &'expr2 &'expr u64[src]

type Expression = Bound<Unsigned<BigInt>, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Unsigned<BigInt>>> for &'expr2 &'expr u64[src]

type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>

impl AsExpression<Unsigned<BigInt>> for u64[src]

type Expression = Bound<Unsigned<BigInt>, Self>

impl AsExpression<Nullable<Unsigned<BigInt>>> for u64[src]

type Expression = Bound<Nullable<Unsigned<BigInt>>, Self>

impl<'expr> AsExpression<Float> for &'expr f32[src]

type Expression = Bound<Float, Self>

impl<'expr> AsExpression<Nullable<Float>> for &'expr f32[src]

type Expression = Bound<Nullable<Float>, Self>

impl<'expr2, 'expr> AsExpression<Float> for &'expr2 &'expr f32[src]

type Expression = Bound<Float, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Float>> for &'expr2 &'expr f32[src]

type Expression = Bound<Nullable<Float>, Self>

impl AsExpression<Float> for f32[src]

type Expression = Bound<Float, Self>

impl AsExpression<Nullable<Float>> for f32[src]

type Expression = Bound<Nullable<Float>, Self>

impl<'expr> AsExpression<Double> for &'expr f64[src]

type Expression = Bound<Double, Self>

impl<'expr> AsExpression<Nullable<Double>> for &'expr f64[src]

type Expression = Bound<Nullable<Double>, Self>

impl<'expr2, 'expr> AsExpression<Double> for &'expr2 &'expr f64[src]

type Expression = Bound<Double, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Double>> for &'expr2 &'expr f64[src]

type Expression = Bound<Nullable<Double>, Self>

impl AsExpression<Double> for f64[src]

type Expression = Bound<Double, Self>

impl AsExpression<Nullable<Double>> for f64[src]

type Expression = Bound<Nullable<Double>, Self>

impl<'expr> AsExpression<Text> for &'expr String[src]

type Expression = Bound<Text, Self>

impl<'expr> AsExpression<Nullable<Text>> for &'expr String[src]

type Expression = Bound<Nullable<Text>, Self>

impl<'expr2, 'expr> AsExpression<Text> for &'expr2 &'expr String[src]

type Expression = Bound<Text, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Text>> for &'expr2 &'expr String[src]

type Expression = Bound<Nullable<Text>, Self>

impl AsExpression<Text> for String[src]

type Expression = Bound<Text, Self>

impl AsExpression<Nullable<Text>> for String[src]

type Expression = Bound<Nullable<Text>, Self>

impl<'expr> AsExpression<Text> for &'expr str[src]

type Expression = Bound<Text, Self>

impl<'expr> AsExpression<Nullable<Text>> for &'expr str[src]

type Expression = Bound<Nullable<Text>, Self>

impl<'expr2, 'expr> AsExpression<Text> for &'expr2 &'expr str[src]

type Expression = Bound<Text, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Text>> for &'expr2 &'expr str[src]

type Expression = Bound<Nullable<Text>, Self>

impl<'expr> AsExpression<Binary> for &'expr Vec<u8>[src]

type Expression = Bound<Binary, Self>

impl<'expr> AsExpression<Nullable<Binary>> for &'expr Vec<u8>[src]

type Expression = Bound<Nullable<Binary>, Self>

impl<'expr2, 'expr> AsExpression<Binary> for &'expr2 &'expr Vec<u8>[src]

type Expression = Bound<Binary, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Binary>> for &'expr2 &'expr Vec<u8>[src]

type Expression = Bound<Nullable<Binary>, Self>

impl AsExpression<Binary> for Vec<u8>[src]

type Expression = Bound<Binary, Self>

impl AsExpression<Nullable<Binary>> for Vec<u8>[src]

type Expression = Bound<Nullable<Binary>, Self>

impl<'expr> AsExpression<Binary> for &'expr [u8][src]

type Expression = Bound<Binary, Self>

impl<'expr> AsExpression<Nullable<Binary>> for &'expr [u8][src]

type Expression = Bound<Nullable<Binary>, Self>

impl<'expr2, 'expr> AsExpression<Binary> for &'expr2 &'expr [u8][src]

type Expression = Bound<Binary, Self>

impl<'expr2, 'expr> AsExpression<Nullable<Binary>> for &'expr2 &'expr [u8][src]

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>, 
[src]

type Expression = Bound<ST, Self>

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]

type Expression = Bound<ST, &'b T>

Loading content...

Implementors

impl AsExpression<Nullable<Timestamp>> for now[src]

type Expression = Coerce<now, Nullable<Timestamp>>

impl<T: Expression> AsExpression<<T as Expression>::SqlType> for T[src]

type Expression = Self

Loading content...