[][src]Trait diesel::prelude::NullableExpressionMethods

pub trait NullableExpressionMethods: Expression + Sized {
    fn nullable(self) -> Nullable<Self> { ... }
}

Methods present on all expressions

Provided methods

fn nullable(self) -> Nullable<Self>

Converts this potentially non-null expression into one which is treated as nullable. This method has no impact on the generated SQL, and is only used to allow certain comparisons that would otherwise fail to compile.

Example

table! {
    posts {
        id -> Integer,
        user_id -> Integer,
        author_name -> Nullable<VarChar>,
    }
}

fn main() {
    use self::users::dsl::*;
    use self::posts::dsl::{posts, author_name};
    let connection = establish_connection();

    let data = users.inner_join(posts)
        .filter(name.nullable().eq(author_name))
        .select(name)
        .load::<String>(&connection);
    println!("{:?}", data);
}
Loading content...

Implementors

impl<T: Expression> NullableExpressionMethods for T[src]

Loading content...