pub struct MockExecutor {
pub executed_queries: Vec<(String, usize)>,
/* private fields */
}Expand description
An in-memory testing stub satisfying the Executor trait without PostgreSQL connections.
Queues mock results that are drained in FIFO order as queries are executed.
Fields§
§executed_queries: Vec<(String, usize)>Records all executed queries as (sql, param_count) tuples.
Implementations§
Source§impl MockExecutor
impl MockExecutor
pub fn new() -> Self
Sourcepub fn push_result(&mut self, rows: Vec<Row>)
pub fn push_result(&mut self, rows: Vec<Row>)
Enqueues a set of rows to be returned by the next query() call.
Sourcepub fn remaining_results(&self) -> usize
pub fn remaining_results(&self) -> usize
Returns the number of remaining mocked result sets.
Trait Implementations§
Source§impl Default for MockExecutor
impl Default for MockExecutor
Auto Trait Implementations§
impl Freeze for MockExecutor
impl RefUnwindSafe for MockExecutor
impl !Send for MockExecutor
impl !Sync for MockExecutor
impl Unpin for MockExecutor
impl UnsafeUnpin for MockExecutor
impl UnwindSafe for MockExecutor
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