pub struct DeleteQuery { /* private fields */ }Expand description
DELETE 查询构造器
Implementations§
Source§impl DeleteQuery
impl DeleteQuery
Sourcepub fn new() -> DeleteQuery
pub fn new() -> DeleteQuery
创建空的 DELETE 查询
Sourcepub fn from_table(self, table: &str) -> DeleteQuery
pub fn from_table(self, table: &str) -> DeleteQuery
设置目标表
Sourcepub fn where_clause(self, condition: &str) -> DeleteQuery
pub fn where_clause(self, condition: &str) -> DeleteQuery
Sourcepub fn where_eq(self, column: &str, value: Value) -> DeleteQuery
pub fn where_eq(self, column: &str, value: Value) -> DeleteQuery
添加 column = ? AND 条件(P0 修复:参数化绑定)
Sourcepub fn where_ne(self, column: &str, value: Value) -> DeleteQuery
pub fn where_ne(self, column: &str, value: Value) -> DeleteQuery
添加 column <> ? AND 条件
Sourcepub fn where_gt(self, column: &str, value: Value) -> DeleteQuery
pub fn where_gt(self, column: &str, value: Value) -> DeleteQuery
添加 column > ? AND 条件
Sourcepub fn where_ge(self, column: &str, value: Value) -> DeleteQuery
pub fn where_ge(self, column: &str, value: Value) -> DeleteQuery
添加 column >= ? AND 条件
Sourcepub fn where_lt(self, column: &str, value: Value) -> DeleteQuery
pub fn where_lt(self, column: &str, value: Value) -> DeleteQuery
添加 column < ? AND 条件
Sourcepub fn where_le(self, column: &str, value: Value) -> DeleteQuery
pub fn where_le(self, column: &str, value: Value) -> DeleteQuery
添加 column <= ? AND 条件
Sourcepub fn where_like(self, column: &str, pattern: Value) -> DeleteQuery
pub fn where_like(self, column: &str, pattern: Value) -> DeleteQuery
添加 column LIKE ? AND 条件
Sourcepub fn where_in(self, column: &str, values: Vec<Value>) -> DeleteQuery
pub fn where_in(self, column: &str, values: Vec<Value>) -> DeleteQuery
添加 column IN (?, ?, ...) AND 条件
Sourcepub fn where_between(self, column: &str, low: Value, high: Value) -> DeleteQuery
pub fn where_between(self, column: &str, low: Value, high: Value) -> DeleteQuery
添加 column BETWEEN ? AND ? AND 条件
Sourcepub fn where_null(self, column: &str) -> DeleteQuery
pub fn where_null(self, column: &str) -> DeleteQuery
添加 column IS NULL AND 条件
Sourcepub fn where_not_null(self, column: &str) -> DeleteQuery
pub fn where_not_null(self, column: &str) -> DeleteQuery
添加 column IS NOT NULL AND 条件
Sourcepub fn returning(self, columns: &[&str]) -> DeleteQuery
pub fn returning(self, columns: &[&str]) -> DeleteQuery
设置 RETURNING 子句(PostgreSQL/SQLite 3.35+ 支持)
在 DELETE 后返回被删除行的指定列值。MySQL 不支持 RETURNING,
在 build()(MySQL 风格)和 build_with_dialect() 的 MySQL 方言下被忽略。
Sourcepub fn returning_all(self) -> DeleteQuery
pub fn returning_all(self) -> DeleteQuery
设置 RETURNING *(返回所有列)
Sourcepub fn build_with_dialect(self, db_type: DbType) -> String
pub fn build_with_dialect(self, db_type: DbType) -> String
按指定方言生成 SQL
Sourcepub fn build_with_params(self, db_type: DbType) -> BuiltQuery
pub fn build_with_params(self, db_type: DbType) -> BuiltQuery
生成带参数的 SQL(参数化查询,P0 修复:SQL 注入防护)
WHERE 条件可来自 where_eq/where_in/where_between 等参数化 API,
用户输入作为参数绑定,而非字符串拼接。
Trait Implementations§
Source§impl Clone for DeleteQuery
impl Clone for DeleteQuery
Source§fn clone(&self) -> DeleteQuery
fn clone(&self) -> DeleteQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Returns the “default value” for a type. Read more
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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