pub struct Delete<'a> { /* private fields */ }
Expand description
A builder for a DELETE
statement.
Implementations§
Source§impl<'a> Delete<'a>
impl<'a> Delete<'a>
Sourcepub fn from_table<T>(table: T) -> Self
pub fn from_table<T>(table: T) -> Self
Creates a new DELETE
statement for the given table.
let query = Delete::from_table("users");
let (sql, _) = renderer::Postgres::build(query);
assert_eq!(r#"DELETE FROM "users""#, sql);
Sourcepub fn so_that<T>(&mut self, conditions: T)where
T: Into<ConditionTree<'a>>,
pub fn so_that<T>(&mut self, conditions: T)where
T: Into<ConditionTree<'a>>,
Adds WHERE
conditions to the query. See
Comparable for more examples.
let mut query = Delete::from_table("users");
query.so_that("bar".equals(false));
let (sql, params) = renderer::Postgres::build(query);
assert_eq!(r#"DELETE FROM "users" WHERE "bar" = $1"#, sql);
assert_eq!(vec![Value::from(false)], params);
Sourcepub fn returning<E, T>(&mut self, returning: T)
pub fn returning<E, T>(&mut self, returning: T)
Adds a RETURNING
definition to the DELETE
statement. Defines the return
value of the query.
let mut query = Delete::from_table("users");
query.returning([Column::from("id"), Column::from("name")]);
let (sql, _) = renderer::Postgres::build(query);
assert_eq!(r#"DELETE FROM "users" RETURNING "id", "name""#, sql);
Trait Implementations§
impl<'a> StructuralPartialEq for Delete<'a>
Auto Trait Implementations§
impl<'a> Freeze for Delete<'a>
impl<'a> RefUnwindSafe for Delete<'a>
impl<'a> Send for Delete<'a>
impl<'a> Sync for Delete<'a>
impl<'a> Unpin for Delete<'a>
impl<'a> UnwindSafe for Delete<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more