sea_orm

Trait MockDatabaseTrait

Source
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;
    fn ping(&self) -> Result<(), DbErr>;
}
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

Source

fn ping(&self) -> Result<(), DbErr>

Ping the MockDatabase

Implementors§

Source§

impl MockDatabaseTrait for MockDatabase

Available on crate feature mock only.