pub struct Transaction { /* private fields */ }Expand description
A database transaction.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub async fn begin(connection: PooledConnection) -> Result<Self, ClientError>
pub async fn begin(connection: PooledConnection) -> Result<Self, ClientError>
Begin a new transaction.
Sourcepub async fn query(&self, sql: &str) -> Result<QueryResult, ClientError>
pub async fn query(&self, sql: &str) -> Result<QueryResult, ClientError>
Execute a query within the transaction.
Sourcepub async fn query_with_params(
&self,
sql: &str,
params: Vec<Value>,
) -> Result<QueryResult, ClientError>
pub async fn query_with_params( &self, sql: &str, params: Vec<Value>, ) -> Result<QueryResult, ClientError>
Execute a query with parameters.
Sourcepub async fn execute(&self, sql: &str) -> Result<u64, ClientError>
pub async fn execute(&self, sql: &str) -> Result<u64, ClientError>
Execute a statement within the transaction.
Sourcepub async fn execute_with_params(
&self,
sql: &str,
params: Vec<Value>,
) -> Result<u64, ClientError>
pub async fn execute_with_params( &self, sql: &str, params: Vec<Value>, ) -> Result<u64, ClientError>
Execute a statement with parameters.
Sourcepub async fn commit(self) -> Result<(), ClientError>
pub async fn commit(self) -> Result<(), ClientError>
Commit the transaction.
Sourcepub async fn rollback(self) -> Result<(), ClientError>
pub async fn rollback(self) -> Result<(), ClientError>
Rollback the transaction.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin 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