pub struct TransactionBuilder<'a> { /* private fields */ }Expand description
Builder for configuring a transaction before starting it.
Obtain one via Db::transaction_builder
or Connection::transaction_builder,
configure isolation level, read-only settings, and lock-acquisition
mode, then call begin to start the transaction.
Implementations§
Source§impl<'a> TransactionBuilder<'a>
impl<'a> TransactionBuilder<'a>
Sourcepub fn isolation(self, level: IsolationLevel) -> TransactionBuilder<'a>
pub fn isolation(self, level: IsolationLevel) -> TransactionBuilder<'a>
Set the isolation level for this transaction.
Sourcepub fn read_only(self, read_only: bool) -> TransactionBuilder<'a>
pub fn read_only(self, read_only: bool) -> TransactionBuilder<'a>
Set whether this transaction is read-only.
Sourcepub fn mode(self, mode: TransactionMode) -> TransactionBuilder<'a>
pub fn mode(self, mode: TransactionMode) -> TransactionBuilder<'a>
Set the lock-acquisition mode for this transaction. See
TransactionMode for the supported modes and which drivers
implement them.
Sourcepub async fn begin(self) -> Result<Transaction<'a>, Error>
pub async fn begin(self) -> Result<Transaction<'a>, Error>
Begin the transaction.
When built from a Db, this acquires a connection from
the pool. The connection is owned by the returned Transaction and
will be returned to the pool when the transaction is dropped.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TransactionBuilder<'a>
impl<'a> !UnwindSafe for TransactionBuilder<'a>
impl<'a> Freeze for TransactionBuilder<'a>
impl<'a> Send for TransactionBuilder<'a>
impl<'a> Sync for TransactionBuilder<'a>
impl<'a> Unpin for TransactionBuilder<'a>
impl<'a> UnsafeUnpin for TransactionBuilder<'a>
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