Skip to main content

IntoExpr

Trait IntoExpr 

Source
pub trait IntoExpr<'column, S> {
    type Typ: DbTyp;

    // Required method
    fn into_expr(self) -> Expr<'column, S, Self::Typ>;
}
Expand description

Trait for all values that can be used as expressions in queries.

There is a hierarchy of types that can be used to build queries.

  • TableRow, i64, f64, bool, &[u8], &str: These are the base types for building expressions. They all implement IntoExpr and are Copy. Note that TableRow is special because it refers to a table row that is guaranteed to exist.
  • Expr is the type that all IntoExpr values can be converted into. It has a lot of methods to combine expressions into more complicated expressions. Next to those, it implements std::ops::Deref, if the expression is a table expression. This can be used to get access to the columns of the table, which can themselves be table expressions. Note that combinators like crate::optional and crate::aggregate also have Expr as return type.

Note that while Expr implements IntoExpr, you may want to use &Expr instead. Using a reference lets you reuse Expr without calling Clone explicitly.

Required Associated Types§

Source

type Typ: DbTyp

The type of the expression.

Required Methods§

Source

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Turn this value into an Expr.

Implementations on Foreign Types§

Source§

impl<'column, S> IntoExpr<'column, S> for &str

Source§

type Typ = String

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for &[u8]

Source§

type Typ = Vec<u8>

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for bool

Source§

type Typ = bool

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for f64

Source§

type Typ = f64

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for i64

Source§

type Typ = i64

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for String

Source§

type Typ = String

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for Vec<u8>

Source§

type Typ = Vec<u8>

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for Date

Available on crate feature jiff-02 only.

Note that dates before 0000-01-01 can not be used in an expression. The reason is that dates are represented in sqlite as strings and for negative years the sorting order is wrong.

Source§

type Typ = Date

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S> IntoExpr<'column, S> for Timestamp

Available on crate feature jiff-02 only.

Note that timestamps before 0000-01-01 00:00:00 can not be used in an expression. The reason is that datetimes are represented in sqlite as strings and for negative years the sorting order is wrong.

The conversion is lossless, everything up to nanoseconds is preserved.

Source§

type Typ = Timestamp

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S, T> IntoExpr<'column, S> for &T
where T: IntoExpr<'column, S> + Clone,

Source§

type Typ = <T as IntoExpr<'column, S>>::Typ

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Source§

impl<'column, S, T: IntoExpr<'column, S, Typ = X>, X: EqTyp> IntoExpr<'column, S> for Option<T>

Source§

type Typ = Option<X>

Source§

fn into_expr(self) -> Expr<'column, S, Self::Typ>

Implementors§

Source§

impl<'column, S, T: DbTyp> IntoExpr<'column, S> for Expr<'column, S, T>

Source§

type Typ = T

Source§

impl<'column, T: Table> IntoExpr<'column, <T as Table>::Schema> for Lazy<'_, T>

Source§

impl<'column, T: Table> IntoExpr<'column, <T as Table>::Schema> for TableRow<T>