pub trait MockDatabaseTrait: Send + Debug {
    // Required methods
    fn execute(
        &mut self,
        counter: usize,
        stmt: Statement
    ) -> Result<ExecResult, DbErr>;
    fn query(
        &mut self,
        counter: usize,
        stmt: Statement
    ) -> Result<Vec<QueryResult>, DbErr>;
    fn begin(&mut self);
    fn commit(&mut self);
    fn rollback(&mut self);
    fn drain_transaction_log(&mut self) -> Vec<Transaction>;
    fn get_database_backend(&self) -> DbBackend;
}
Expand description

A Trait for any type wanting to perform operations on the MockDatabase

Required Methods§

source

fn execute( &mut self, counter: usize, stmt: Statement ) -> Result<ExecResult, DbErr>

Execute a statement in the MockDatabase

source

fn query( &mut self, counter: usize, stmt: Statement ) -> Result<Vec<QueryResult>, DbErr>

Execute a SQL query in the MockDatabase

source

fn begin(&mut self)

Create a transaction that can be committed atomically

source

fn commit(&mut self)

Commit a successful transaction atomically into the MockDatabase

source

fn rollback(&mut self)

Roll back a transaction since errors were encountered

source

fn drain_transaction_log(&mut self) -> Vec<Transaction>

Get all logs from a MockDatabase and return a Transaction

source

fn get_database_backend(&self) -> DbBackend

Get the backend being used in the MockDatabase

Implementors§

source§

impl MockDatabaseTrait for MockDatabase

Available on crate feature mock only.