pub struct DeleteQuery { /* private fields */ }Expand description
DELETE 查询构造器
Implementations§
Source§impl DeleteQuery
impl DeleteQuery
Sourcepub fn from_table(self, table: &str) -> Self
pub fn from_table(self, table: &str) -> Self
设置目标表
Sourcepub fn where_clause(self, condition: &str) -> Self
pub fn where_clause(self, condition: &str) -> Self
Sourcepub fn where_like(self, column: &str, pattern: Value) -> Self
pub fn where_like(self, column: &str, pattern: Value) -> Self
添加 column LIKE ? AND 条件
Sourcepub fn where_in(self, column: &str, values: Vec<Value>) -> Self
pub fn where_in(self, column: &str, values: Vec<Value>) -> Self
添加 column IN (?, ?, ...) AND 条件
Sourcepub fn where_between(self, column: &str, low: Value, high: Value) -> Self
pub fn where_between(self, column: &str, low: Value, high: Value) -> Self
添加 column BETWEEN ? AND ? AND 条件
Sourcepub fn where_null(self, column: &str) -> Self
pub fn where_null(self, column: &str) -> Self
添加 column IS NULL AND 条件
Sourcepub fn where_not_null(self, column: &str) -> Self
pub fn where_not_null(self, column: &str) -> Self
添加 column IS NOT NULL AND 条件
Sourcepub fn returning(self, columns: &[&str]) -> Self
pub fn returning(self, columns: &[&str]) -> Self
设置 RETURNING 子句(PostgreSQL/SQLite 3.35+ 支持)
在 DELETE 后返回被删除行的指定列值。MySQL 不支持 RETURNING,
在 build()(MySQL 风格)和 build_with_dialect() 的 MySQL 方言下被忽略。
Sourcepub fn returning_all(self) -> Self
pub fn returning_all(self) -> Self
设置 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