pub struct Transaction { /* private fields */ }Expand description
A PostgreSQL transaction for the asynchronous connection.
This struct provides transaction control. The connection is passed
to commit and rollback methods to execute the transaction commands.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub async fn commit(self, conn: &mut Conn) -> Result<()>
pub async fn commit(self, conn: &mut Conn) -> Result<()>
Commit the transaction.
This consumes the transaction and sends a COMMIT statement to the server. The connection must be passed as an argument to execute the commit.
§Errors
Returns Error::InvalidUsage if the connection is not the same
as the one that started the transaction.
Sourcepub async fn rollback(self, conn: &mut Conn) -> Result<()>
pub async fn rollback(self, conn: &mut Conn) -> Result<()>
Rollback the transaction.
This consumes the transaction and sends a ROLLBACK statement to the server. The connection must be passed as an argument to execute the rollback.
§Errors
Returns Error::InvalidUsage if the connection is not the same
as the one that started the transaction.
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