Function diesel::dsl::delete

source ·
pub fn delete<T: IntoUpdateTarget>(
    source: T,
) -> DeleteStatement<T::Table, T::WhereClause>
Expand description

Creates a DELETE statement.

When a table is passed to delete, every row in the table will be deleted. This scope can be narrowed by calling filter on the table before it is passed in.


§Deleting a single record:

let old_count = users.count().first::<i64>(connection);
assert_eq!(|count| count - 1), users.count().first(connection));

§Deleting a whole table:

assert_eq!(Ok(0), users.count().first::<i64>(connection));