Struct photon_indexer::migration::sea_orm::MockDatabase
source · pub struct MockDatabase { /* private fields */ }Expand description
Defines a Mock database suitable for testing
Implementations§
source§impl MockDatabase
impl MockDatabase
sourcepub fn new(db_backend: DatabaseBackend) -> MockDatabase
pub fn new(db_backend: DatabaseBackend) -> MockDatabase
Instantiate a mock database with a DbBackend to simulate real world SQL databases
sourcepub fn into_connection(self) -> DatabaseConnection
pub fn into_connection(self) -> DatabaseConnection
Create a database connection
sourcepub fn append_exec_results(self, vec: Vec<MockExecResult>) -> MockDatabase
pub fn append_exec_results(self, vec: Vec<MockExecResult>) -> MockDatabase
Add some MockExecResults to exec_results
sourcepub fn append_query_results<T>(self, vec: Vec<Vec<T>>) -> MockDatabasewhere
T: IntoMockRow,
pub fn append_query_results<T>(self, vec: Vec<Vec<T>>) -> MockDatabasewhere
T: IntoMockRow,
Add some Values to query_results
sourcepub fn append_exec_errors(self, vec: Vec<DbErr>) -> MockDatabase
pub fn append_exec_errors(self, vec: Vec<DbErr>) -> MockDatabase
Add some DbErrs to exec_results
sourcepub fn append_query_errors(self, vec: Vec<DbErr>) -> MockDatabase
pub fn append_query_errors(self, vec: Vec<DbErr>) -> MockDatabase
Add some DbErrs to query_results
Trait Implementations§
source§impl Debug for MockDatabase
impl Debug for MockDatabase
source§impl MockDatabaseTrait for MockDatabase
impl MockDatabaseTrait for MockDatabase
source§fn execute(
&mut self,
counter: usize,
statement: Statement
) -> Result<ExecResult, DbErr>
fn execute( &mut self, counter: usize, statement: Statement ) -> Result<ExecResult, DbErr>
Execute a statement in the MockDatabase
source§fn query(
&mut self,
counter: usize,
statement: Statement
) -> Result<Vec<QueryResult>, DbErr>
fn query( &mut self, counter: usize, statement: Statement ) -> Result<Vec<QueryResult>, DbErr>
Execute a SQL query in the MockDatabase
source§fn commit(&mut self)
fn commit(&mut self)
Commit a successful transaction atomically into the MockDatabase
source§fn 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
source§fn get_database_backend(&self) -> DatabaseBackend
fn get_database_backend(&self) -> DatabaseBackend
Get the backend being used in the MockDatabase
Auto Trait Implementations§
impl Freeze for MockDatabase
impl !RefUnwindSafe for MockDatabase
impl Send for MockDatabase
impl Sync for MockDatabase
impl Unpin for MockDatabase
impl !UnwindSafe for MockDatabase
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more