pub struct TransactionGuard<'a> { /* private fields */ }Expand description
Transaction safety wrapper for automatic rollback on errors
This wrapper holds onto a connection wrapper for the duration of a transaction. Note: Due to lifetime constraints, this is typically used within a function scope.
Implementations§
Source§impl<'a> TransactionGuard<'a>
impl<'a> TransactionGuard<'a>
Sourcepub fn new(conn: ConnectionWrapper<'a>) -> Result<Self, SqliteGraphError>
pub fn new(conn: ConnectionWrapper<'a>) -> Result<Self, SqliteGraphError>
Start a new transaction with IMMEDIATE mode for better write performance
Sourcepub fn commit(self, graph: &SqliteGraph) -> Result<(), SqliteGraphError>
pub fn commit(self, graph: &SqliteGraph) -> Result<(), SqliteGraphError>
Commit the transaction with cache invalidation and snapshot update
Sourcepub fn conn(&self) -> &ConnectionWrapper<'a>
pub fn conn(&self) -> &ConnectionWrapper<'a>
Get reference to the underlying connection wrapper
Sourcepub fn execute<F, R>(
self,
graph: &SqliteGraph,
f: F,
) -> Result<R, SqliteGraphError>
pub fn execute<F, R>( self, graph: &SqliteGraph, f: F, ) -> Result<R, SqliteGraphError>
Execute a function with automatic rollback on error
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Freeze for TransactionGuard<'a>
impl<'a> !RefUnwindSafe for TransactionGuard<'a>
impl<'a> !Send for TransactionGuard<'a>
impl<'a> !Sync for TransactionGuard<'a>
impl<'a> Unpin for TransactionGuard<'a>
impl<'a> !UnwindSafe for TransactionGuard<'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
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