pub struct Transaction { /* private fields */ }Expand description
Transactions can be used to provide a safe way to execute multiple SQL operations after another with a way to go back to the start without something changed in the database.
Can be obtained using Database::start_transaction.
Implementations§
Source§impl Transaction
impl Transaction
Source§impl Transaction
impl Transaction
Sourcepub fn hooks(&mut self) -> SimpleHooksApi<'_>
pub fn hooks(&mut self) -> SimpleHooksApi<'_>
Accesses the simple API for adding hooks to the transaction
If you reach the API’s limits, consider Transaction::adv_hooks.
Sourcepub fn adv_hooks(&mut self) -> AdvancedHooksApi<'_>
pub fn adv_hooks(&mut self) -> AdvancedHooksApi<'_>
Accesses the advanced API for adding hooks to the transaction
If you’re new to transaction hooks, consider Transaction::hooks.
Trait Implementations§
Source§impl<'executor> Executor<'executor> for &'executor mut Transaction
impl<'executor> Executor<'executor> for &'executor mut Transaction
Source§type EnsureTransactionFuture = Ready<Result<TransactionGuard<'executor>, Error>>
type EnsureTransactionFuture = Ready<Result<TransactionGuard<'executor>, Error>>
A future producing a
TransactionGuard returned by ensure_transactionSource§fn execute<'data, 'result, Q>(
self,
query: String,
values: Vec<Value<'data>>,
) -> Q::Result<'result>where
Q: QueryStrategy,
'executor: 'result,
'data: 'result,
fn execute<'data, 'result, Q>(
self,
query: String,
values: Vec<Value<'data>>,
) -> Q::Result<'result>where
Q: QueryStrategy,
'executor: 'result,
'data: 'result,
Executes a raw SQL query Read more
Source§fn into_dyn(self) -> DynamicExecutor<'executor>
fn into_dyn(self) -> DynamicExecutor<'executor>
Convenience method to convert into a “
dyn Executor”Source§fn ensure_transaction(
self,
) -> Pin<Box<dyn Future<Output = Result<TransactionGuard<'executor>, Error>> + Send + 'executor>>
fn ensure_transaction( self, ) -> Pin<Box<dyn Future<Output = Result<TransactionGuard<'executor>, Error>> + Send + 'executor>>
Ensure a piece of code is run inside a transaction using a
TransactionGuard. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Transaction
impl !Sync for Transaction
impl !UnwindSafe for Transaction
impl Freeze for Transaction
impl Send for Transaction
impl Unpin for Transaction
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more