pub struct SqlStmt {
pub text: String,
pub params: Vec<Value>,
pub is_write: bool,
pub row_shape: Option<RowShape>,
pub returning: Vec<String>,
}Expand description
一条参数化 SQL 语句(参数位置用 ? / $n 占位,params 顺序对应)
Fields§
§text: StringSQL 文本(标识符已按后端加引号,值全部参数化)
params: Vec<Value>绑定参数(按占位顺序)
is_write: bool是否为写语句
row_shape: Option<RowShape>SELECT 时的「列 → JSON 还原路径」元数据(见 row_shape)
returning: Vec<String>RETURNING 列(PG/SQLite 写语句回读用;MySQL 无)
Implementations§
Source§impl SqlStmt
impl SqlStmt
pub fn select(text: String, params: Vec<Value>, row_shape: RowShape) -> Self
pub fn write(text: String, params: Vec<Value>) -> Self
Sourcepub fn write_returning(
text: String,
params: Vec<Value>,
row_shape: RowShape,
) -> Self
pub fn write_returning( text: String, params: Vec<Value>, row_shape: RowShape, ) -> Self
写语句 + 行形状(SQLite claim 的 UPDATE … RETURNING:既写又取行;
执行器按 rowShape 还原行为文档,行数即领取数)
pub fn to_value(&self) -> Value
Trait Implementations§
impl StructuralPartialEq for SqlStmt
Auto Trait Implementations§
impl Freeze for SqlStmt
impl RefUnwindSafe for SqlStmt
impl Send for SqlStmt
impl Sync for SqlStmt
impl Unpin for SqlStmt
impl UnsafeUnpin for SqlStmt
impl UnwindSafe for SqlStmt
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