pub struct TransactionTicket<'t, 's> { /* private fields */ }Expand description
An active ticket for a semi-entered transaction.
A TransactionTicket manages the lifecycle of the Transaction, allowing
for explicit commit or rollback operations. It ensures that any changes
made within the transaction are properly finalized or reverted.
§Generic Lifetimes
't: Lifetime of the referencedTransaction.'s: Lifetime of theSQLxtransaction.
Implementations§
Source§impl<'t> TransactionTicket<'t, '_>
impl<'t> TransactionTicket<'t, '_>
Sourcepub async fn commit(&mut self) -> Result<&'t Transaction, FinanceError>
pub async fn commit(&mut self) -> Result<&'t Transaction, FinanceError>
Sourcepub async fn rollback(&mut self) -> Result<&'t Transaction, FinanceError>
pub async fn rollback(&mut self) -> Result<&'t Transaction, FinanceError>
pub async fn add_splits( &mut self, splits: &[&Split], ) -> Result<&'t Transaction, FinanceError>
pub async fn add_conversions( &mut self, prices: &[&Price], ) -> Result<&'t Transaction, FinanceError>
Sourcepub async fn execute<F, Fut, T>(&mut self, f: F) -> Result<T, FinanceError>
pub async fn execute<F, Fut, T>(&mut self, f: F) -> Result<T, FinanceError>
Execute an arbitrary async operation within this ticket’s DB transaction.
This enables custom operations (like adding split tags) without adding specific methods for each entity type.
Auto Trait Implementations§
impl<'t, 's> Freeze for TransactionTicket<'t, 's>
impl<'t, 's> !RefUnwindSafe for TransactionTicket<'t, 's>
impl<'t, 's> Send for TransactionTicket<'t, 's>
impl<'t, 's> Sync for TransactionTicket<'t, 's>
impl<'t, 's> Unpin for TransactionTicket<'t, 's>
impl<'t, 's> UnsafeUnpin for TransactionTicket<'t, 's>
impl<'t, 's> !UnwindSafe for TransactionTicket<'t, 's>
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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