Struct sea_orm::MockDatabase
source · [−]pub struct MockDatabase { /* private fields */ }
Expand description
Defines a Mock database suitable for testing
Implementations
sourceimpl MockDatabase
impl MockDatabase
sourcepub fn new(db_backend: DbBackend) -> Self
pub fn new(db_backend: DbBackend) -> Self
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>) -> Self
pub fn append_exec_results(self, vec: Vec<MockExecResult>) -> Self
Add the MockExecResults to the exec_results
field for Self
sourcepub fn append_query_results<T>(self, vec: Vec<Vec<T>>) -> Self where
T: IntoMockRow,
pub fn append_query_results<T>(self, vec: Vec<Vec<T>>) -> Self where
T: IntoMockRow,
Add the MockExecResults to the exec_results
field for Self
Trait Implementations
sourceimpl Debug for MockDatabase
impl Debug for MockDatabase
sourceimpl MockDatabaseTrait for MockDatabase
impl MockDatabaseTrait for MockDatabase
sourcefn 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
sourcefn 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
sourcefn commit(&mut self)
fn commit(&mut self)
Commit a successful transaction atomically into the MockDatabase
sourcefn drain_transaction_log(&mut self) -> Vec<Transaction>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn drain_transaction_log(&mut self) -> Vec<Transaction>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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
Auto Trait Implementations
impl RefUnwindSafe for MockDatabase
impl Send for MockDatabase
impl Sync for MockDatabase
impl Unpin for MockDatabase
impl UnwindSafe for MockDatabase
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more