pub struct DeleteQuery { /* private fields */ }Expand description
DELETE query builder
Implementations§
Source§impl DeleteQuery
impl DeleteQuery
Sourcepub fn from_table(self, table: &str) -> Self
pub fn from_table(self, table: &str) -> Self
Set the target table
Sourcepub fn where_clause(self, condition: &str) -> Self
pub fn where_clause(self, condition: &str) -> Self
Add a WHERE condition
§Security (v0.2.2 fix C-6)
Calls check_where_injection to detect high-risk patterns.
Sourcepub fn where_eq(self, column: &str, value: Value) -> Self
pub fn where_eq(self, column: &str, value: Value) -> Self
Add a column = ? AND condition (P0 fix: parameterized binding)
Sourcepub fn where_like(self, column: &str, pattern: Value) -> Self
pub fn where_like(self, column: &str, pattern: Value) -> Self
Add a column LIKE ? AND condition
Sourcepub fn where_in(self, column: &str, values: Vec<Value>) -> Self
pub fn where_in(self, column: &str, values: Vec<Value>) -> Self
Add a column IN (?, ?, ...) AND condition
Sourcepub fn where_between(self, column: &str, low: Value, high: Value) -> Self
pub fn where_between(self, column: &str, low: Value, high: Value) -> Self
Add a column BETWEEN ? AND ? AND condition
Sourcepub fn where_null(self, column: &str) -> Self
pub fn where_null(self, column: &str) -> Self
Add a column IS NULL AND condition
Sourcepub fn where_not_null(self, column: &str) -> Self
pub fn where_not_null(self, column: &str) -> Self
Add a column IS NOT NULL AND condition
Sourcepub fn returning(self, columns: &[&str]) -> Self
pub fn returning(self, columns: &[&str]) -> Self
Set the RETURNING clause (supported by PostgreSQL/SQLite 3.35+)
Returns the specified column values of deleted rows after DELETE. MySQL does not
support RETURNING; it is ignored in build() (MySQL style) and under MySQL dialect
in build_with_dialect().
Sourcepub fn returning_all(self) -> Self
pub fn returning_all(self) -> Self
Set RETURNING * (return all columns)
Sourcepub fn build(self) -> String
pub fn build(self) -> String
Generate SQL
§Security (gate 9 fix)
The table name is escaped via quote_ident() and wrapped in backticks, preventing
malicious table names containing ` from breaking out.
Sourcepub fn build_with_dialect(self, db_type: DbType) -> String
pub fn build_with_dialect(self, db_type: DbType) -> String
Generate SQL for the specified dialect
Sourcepub fn build_with_params(self, db_type: DbType) -> BuiltQuery
pub fn build_with_params(self, db_type: DbType) -> BuiltQuery
Generate parameterized SQL (parameterized query, P0 fix: SQL injection prevention)
WHERE conditions can come from parameterized APIs like where_eq/where_in/where_between,
with user input bound as parameters rather than string concatenation.
Trait Implementations§
Source§impl Clone for DeleteQuery
impl Clone for DeleteQuery
Source§fn clone(&self) -> DeleteQuery
fn clone(&self) -> DeleteQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeleteQuery
impl Debug for DeleteQuery
Source§impl Default for DeleteQuery
impl Default for DeleteQuery
Source§fn default() -> DeleteQuery
fn default() -> DeleteQuery
Auto Trait Implementations§
impl Freeze for DeleteQuery
impl RefUnwindSafe for DeleteQuery
impl Send for DeleteQuery
impl Sync for DeleteQuery
impl Unpin for DeleteQuery
impl UnsafeUnpin for DeleteQuery
impl UnwindSafe for DeleteQuery
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more