pub struct Transaction<'a, DB: Database> { /* private fields */ }Expand description
A database transaction with auto-rollback on drop.
If the transaction is dropped without calling commit,
it will automatically roll back.
Implementations§
Source§impl<'a, DB: Database> Transaction<'a, DB>
impl<'a, DB: Database> Transaction<'a, DB>
Sourcepub async fn commit(self) -> Result<(), FletchError>
pub async fn commit(self) -> Result<(), FletchError>
Commit the transaction.
Sourcepub async fn rollback(self) -> Result<(), FletchError>
pub async fn rollback(self) -> Result<(), FletchError>
Explicitly roll back the transaction.
Sourcepub fn inner_mut(&mut self) -> &mut Transaction<'a, DB>
pub fn inner_mut(&mut self) -> &mut Transaction<'a, DB>
Returns a mutable reference to the underlying sqlx transaction.
Escape hatch for advanced or raw SQLx access. Prefer fletch CRUD and the query builder where possible.
Auto Trait Implementations§
impl<'a, DB> !RefUnwindSafe for Transaction<'a, DB>
impl<'a, DB> !UnwindSafe for Transaction<'a, DB>
impl<'a, DB> Freeze for Transaction<'a, DB>
impl<'a, DB> Send for Transaction<'a, DB>
impl<'a, DB> Sync for Transaction<'a, DB>
impl<'a, DB> Unpin for Transaction<'a, DB>
impl<'a, DB> UnsafeUnpin for Transaction<'a, DB>
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