Trait diesel::expression_methods::NullableExpressionMethods[][src]

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

Methods present on all expressions

Provided methods

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);
}

Implementors