pub struct MockDatabaseConnection { /* private fields */ }
Expand description
Defines a connection for the MockDatabase
Implementationsยง
Sourceยงimpl MockDatabaseConnection
impl MockDatabaseConnection
Sourcepub 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
Sourcepub 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.
Sourcepub fn execute(&self, statement: Statement) -> Result<ExecResult, DbErr>
pub fn execute(&self, statement: Statement) -> Result<ExecResult, DbErr>
Execute the SQL statement in the MockDatabase
Sourcepub 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
Sourcepub 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
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