pub struct Statement { /* private fields */ }Expand description
A raw SQL statement that returns an affected-row count.
Create one with statement.
Implementations§
Source§impl Statement
impl Statement
Sourcepub fn bind(self, value: impl Into<Value>) -> Statement
pub fn bind(self, value: impl Into<Value>) -> Statement
Bind a value using the executor driver’s default database type for that value.
Values are bound in the order this method is called. Use
bind_typed for NULL, empty lists, or values
whose database type cannot be inferred from the value alone.
Sourcepub fn bind_typed(self, value: impl Into<Value>, ty: Type) -> Statement
pub fn bind_typed(self, value: impl Into<Value>, ty: Type) -> Statement
Bind a value with an explicit database type.
This is useful for NULL, empty lists, or backend-specific column
types.
ⓘ
use toasty::schema::db;
toasty::sql::statement(
"UPDATE users SET archived_at = ?1 WHERE id = ?2",
)
.bind_typed(toasty::stmt::Value::Null, db::Type::Timestamp(6))
.bind(1_i64)
.exec(&mut db)
.await?;Sourcepub async fn exec(self, executor: &mut dyn Executor) -> Result<u64, Error>
pub async fn exec(self, executor: &mut dyn Executor) -> Result<u64, Error>
Execute the statement and return the affected-row count.
The executor may be a Db, Connection,
or Transaction.
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
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