pub struct Transaction { /* private fields */ }Expand description
A database transaction.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Returns the transaction ID.
Sourcepub fn state(&self) -> TransactionState
pub fn state(&self) -> TransactionState
Returns the current state.
Sourcepub fn insert(
&mut self,
cache: &mut TableCache,
table: &str,
row: Row,
) -> Result<RowId>
pub fn insert( &mut self, cache: &mut TableCache, table: &str, row: Row, ) -> Result<RowId>
Inserts a row within this transaction.
Sourcepub fn update(
&mut self,
cache: &mut TableCache,
table: &str,
row_id: RowId,
new_row: Row,
) -> Result<()>
pub fn update( &mut self, cache: &mut TableCache, table: &str, row_id: RowId, new_row: Row, ) -> Result<()>
Updates a row within this transaction.
Sourcepub fn delete(
&mut self,
cache: &mut TableCache,
table: &str,
row_id: RowId,
) -> Result<Row>
pub fn delete( &mut self, cache: &mut TableCache, table: &str, row_id: RowId, ) -> Result<Row>
Deletes a row within this transaction.
Sourcepub fn commit(self) -> Result<Vec<JournalEntry>>
pub fn commit(self) -> Result<Vec<JournalEntry>>
Commits the transaction.
Sourcepub fn rollback(self, cache: &mut TableCache) -> Result<()>
pub fn rollback(self, cache: &mut TableCache) -> Result<()>
Rolls back the transaction.
Sourcepub fn get_changes(&self) -> &[JournalEntry]
pub fn get_changes(&self) -> &[JournalEntry]
Returns the journal entries.
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe 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