keelson_sqlite/delete.rs
1//! Mods for [`sqlite::delete`](crate::delete()).
2//!
3//! The shortest of the four modules, because the statement is:
4//!
5//! ```text
6//! [WITH …] DELETE FROM qualified-table-name [WHERE expr] [RETURNING …]
7//! ```
8//!
9//! ```
10//! use keelson_sqlite as sqlite;
11//! use keelson_sqlite::{Chain, arg, delete, quote, select, subquery};
12//!
13//! let q = sqlite::delete((
14//! delete::from(quote("comments")),
15//! delete::where_(quote("post_id").in_(subquery(sqlite::select((
16//! select::columns(quote("id")),
17//! select::from(quote("posts")),
18//! select::where_(quote("status").eq(arg("draft"))),
19//! ))))),
20//! delete::returning(quote("id")),
21//! ));
22//! ```
23//!
24//! SQLite has no `USING`, so there is no `using`, no `using_also` and no join mod:
25//! a delete driven by another table is written with a sub-query in the `WHERE`, as
26//! above. It has no `conflict-clause` either, so none of the `or_*` mods appear —
27//! only `INSERT` and `UPDATE` can violate a constraint. And no `limit`/`order_by`,
28//! for the reason [`mod@crate::update`] gives.
29
30pub use crate::shared::{recursive, returning, target_table as from, where_, with};