pub struct Transaction { /* private fields */ }Expand description
A database transaction.
Created by Pool::begin(). Must be explicitly
committed via commit(). If dropped without
commit(), the connection is discarded from the pool.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub async fn commit(self) -> BsqlResult<()>
pub async fn commit(self) -> BsqlResult<()>
Commit the transaction and return the connection to the pool.
Consumes self — the transaction cannot be used after commit.
Sourcepub async fn rollback(self) -> BsqlResult<()>
pub async fn rollback(self) -> BsqlResult<()>
Explicitly roll back the transaction and return the connection to the pool.
Consumes self — the transaction cannot be used after rollback.
Trait Implementations§
Source§impl Debug for Transaction
impl Debug for Transaction
Source§impl Drop for Transaction
impl Drop for Transaction
Source§impl Executor for Transaction
impl Executor for Transaction
Source§async fn query_raw(
&self,
sql: &str,
params: &[&(dyn ToSql + Sync)],
) -> BsqlResult<Arc<Vec<Row>>>
async fn query_raw( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> BsqlResult<Arc<Vec<Row>>>
Execute a query and return all rows (shared via Arc for singleflight).
Source§async fn query_raw_readonly(
&self,
sql: &str,
params: &[&(dyn ToSql + Sync)],
) -> BsqlResult<Arc<Vec<Row>>>
async fn query_raw_readonly( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> BsqlResult<Arc<Vec<Row>>>
Execute a read-only query. Routes to replicas when available. Read more
Source§async fn execute_raw(
&self,
sql: &str,
params: &[&(dyn ToSql + Sync)],
) -> BsqlResult<u64>
async fn execute_raw( &self, sql: &str, params: &[&(dyn ToSql + Sync)], ) -> BsqlResult<u64>
Execute a query and return the number of affected rows.
Auto Trait Implementations§
impl Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl !UnwindSafe for Transaction
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