Struct MockDatabaseConnection
pub struct MockDatabaseConnection { /* private fields */ }Expand description
Defines a connection for the MockDatabase
Implementations§
§impl MockDatabaseConnection
impl MockDatabaseConnection
pub fn new<M>(m: M) -> Selfwhere
M: MockDatabaseTrait + 'static,
pub fn new<M>(m: M) -> Selfwhere
M: MockDatabaseTrait + 'static,
Create a connection to the MockDatabase
pub fn get_database_backend(&self) -> DbBackend
pub fn get_database_backend(&self) -> DbBackend
Get the DatabaseBackend being used by the MockDatabase
§Panics
Will panic if the lock cannot be acquired.
pub fn execute(&self, statement: Statement) -> Result<ExecResult, DbErr>
pub fn execute(&self, statement: Statement) -> Result<ExecResult, DbErr>
Execute the SQL statement in the MockDatabase
pub fn query_one(
&self,
statement: Statement,
) -> Result<Option<QueryResult>, DbErr>
pub fn query_one( &self, statement: Statement, ) -> Result<Option<QueryResult>, DbErr>
Return one QueryResult if the query was successful
pub fn query_all(&self, statement: Statement) -> Result<Vec<QueryResult>, DbErr>
pub fn query_all(&self, statement: Statement) -> Result<Vec<QueryResult>, DbErr>
Return all QueryResults if the query was successful
pub fn fetch(
&self,
statement: &Statement,
) -> Pin<Box<dyn Stream<Item = Result<QueryResult, DbErr>> + Send>>
pub fn fetch( &self, statement: &Statement, ) -> Pin<Box<dyn Stream<Item = Result<QueryResult, DbErr>> + Send>>
Return QueryResults from a multi-query operation
pub fn begin(&self)
pub fn begin(&self)
Create a statement block of SQL statements that execute together.
§Panics
Will panic if the lock cannot be acquired.
pub fn commit(&self)
pub fn commit(&self)
pub fn rollback(&self)
pub fn rollback(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MockDatabaseConnection
impl RefUnwindSafe for MockDatabaseConnection
impl Send for MockDatabaseConnection
impl Sync for MockDatabaseConnection
impl Unpin for MockDatabaseConnection
impl UnwindSafe for MockDatabaseConnection
Blanket Implementations§
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