Skip to main content

Transaction

Trait Transaction 

Source
pub trait Transaction: Send + Sync {
    // Required methods
    fn execute_query(
        &self,
        sql: &str,
        params: &[&dyn Display],
    ) -> Result<Vec<HashMap<String, String>>>;
    fn execute_command(&self, sql: &str, params: &[&dyn Display]) -> Result<u64>;
    fn commit(self: Box<Self>) -> Result<()>;
    fn rollback(self: Box<Self>) -> Result<()>;
}
Expand description

Transaction trait for managing database transactions

Required Methods§

Source

fn execute_query( &self, sql: &str, params: &[&dyn Display], ) -> Result<Vec<HashMap<String, String>>>

Execute a query within the transaction

Source

fn execute_command(&self, sql: &str, params: &[&dyn Display]) -> Result<u64>

Execute a command within the transaction

Source

fn commit(self: Box<Self>) -> Result<()>

Commit the transaction

Source

fn rollback(self: Box<Self>) -> Result<()>

Rollback the transaction

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§