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§
Sourcefn execute(
&mut self,
counter: usize,
stmt: Statement,
) -> Result<ExecResult, DbErr>
fn execute( &mut self, counter: usize, stmt: Statement, ) -> Result<ExecResult, DbErr>
Execute a statement in the MockDatabase
Sourcefn query(
&mut self,
counter: usize,
stmt: Statement,
) -> Result<Vec<QueryResult>, DbErr>
fn query( &mut self, counter: usize, stmt: Statement, ) -> Result<Vec<QueryResult>, DbErr>
Execute a SQL query in the MockDatabase
Sourcefn commit(&mut self)
fn commit(&mut self)
Commit a successful transaction atomically into the MockDatabase
Sourcefn drain_transaction_log(&mut self) -> Vec<Transaction>
fn drain_transaction_log(&mut self) -> Vec<Transaction>
Get all logs from a MockDatabase and return a Transaction
Sourcefn get_database_backend(&self) -> DbBackend
fn get_database_backend(&self) -> DbBackend
Get the backend being used in the MockDatabase
Implementors§
impl MockDatabaseTrait for MockDatabase
Available on crate feature
mock
only.