pub struct TransactionContext<'t, Tx, Repos> { /* private fields */ }Expand description
Active transaction context with repository adapters.
This struct holds the database transaction and provides access to repository adapters that operate within the transaction.
§Automatic Rollback
If dropped without explicit commit, the transaction is automatically rolled back via the underlying database transaction’s Drop impl.
§Type Parameters
't— Transaction lifetimeTx— Transaction type (e.g.,sqlx::Transaction<'t, Postgres>)Repos— Tuple of repository adapters
Implementations§
Source§impl<'t, Tx, Repos> TransactionContext<'t, Tx, Repos>
impl<'t, Tx, Repos> TransactionContext<'t, Tx, Repos>
Sourcepub fn transaction(&mut self) -> &mut Tx
pub fn transaction(&mut self) -> &mut Tx
Get mutable reference to the underlying transaction.
Use this for custom queries within the transaction.
Sourcepub fn repos_mut(&mut self) -> &mut Repos
pub fn repos_mut(&mut self) -> &mut Repos
Get mutable reference to repository adapters.
Auto Trait Implementations§
impl<'t, Tx, Repos> Freeze for TransactionContext<'t, Tx, Repos>
impl<'t, Tx, Repos> RefUnwindSafe for TransactionContext<'t, Tx, Repos>where
Tx: RefUnwindSafe,
Repos: RefUnwindSafe,
impl<'t, Tx, Repos> Send for TransactionContext<'t, Tx, Repos>
impl<'t, Tx, Repos> Sync for TransactionContext<'t, Tx, Repos>
impl<'t, Tx, Repos> Unpin for TransactionContext<'t, Tx, Repos>
impl<'t, Tx, Repos> UnwindSafe for TransactionContext<'t, Tx, Repos>where
Tx: UnwindSafe,
Repos: UnwindSafe,
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
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