Function diesel::expression::exists::exists

source ·
pub fn exists<T>(query: T) -> exists<T>
Available on crate feature i-implement-a-third-party-backend-and-opt-into-breaking-changes only.
Expand description

Creates a SQL EXISTS expression.

The argument must be a complete SQL query. The query may reference columns from the outer table.

Example

let sean_exists = select(exists(users.filter(name.eq("Sean"))))
    .get_result(connection);
let jim_exists = select(exists(users.filter(name.eq("Jim"))))
    .get_result(connection);
assert_eq!(Ok(true), sean_exists);
assert_eq!(Ok(false), jim_exists);