pub struct Defective<'a, R> { /* private fields */ }Expand description
A backend with one Defect injected. The wrapped backend does the work.
Implementations§
Trait Implementations§
Source§impl<R: RelationalBackend> Migrates for Defective<'_, R>
The known-bad migrator: no ledger, no checksum, no transaction. It runs each migration’s
statements (split on ;) straight on the wrapped backend every time it is asked.
impl<R: RelationalBackend> Migrates for Defective<'_, R>
The known-bad migrator: no ledger, no checksum, no transaction. It runs each migration’s
statements (split on ;) straight on the wrapped backend every time it is asked.
Source§async fn migrate(
&self,
migrations: &[Migration],
) -> Result<MigrateReport, MigrateError>
async fn migrate( &self, migrations: &[Migration], ) -> Result<MigrateReport, MigrateError>
Apply
migrations in version order, skipping those already applied. Each migration runs in
its own transaction where the database can; refuses (applying nothing further) if an applied
migration’s text has changed, if the database has applied a version the program does not
know, or if a migration is recorded as dirty.Source§async fn applied_versions(&self) -> Result<Vec<i64>, MigrateError>
async fn applied_versions(&self) -> Result<Vec<i64>, MigrateError>
The versions the ledger says succeeded, ascending; empty if there is no ledger yet.
Source§impl<R: RelationalBackend> RelationalBackend for Defective<'_, R>
impl<R: RelationalBackend> RelationalBackend for Defective<'_, R>
Source§type Tx<'a> = DefectiveTx<'a, R>
where
Self: 'a
type Tx<'a> = DefectiveTx<'a, R> where Self: 'a
A transaction on this backend. Dropping it without
commit rolls it back.Source§async fn execute(&self, sql: &str, params: &[Value]) -> Result<u64, RelError>
async fn execute(&self, sql: &str, params: &[Value]) -> Result<u64, RelError>
Run a statement that returns no rows; the result is the number of rows affected.
Source§async fn query(&self, sql: &str, params: &[Value]) -> Result<Vec<Row>, RelError>
async fn query(&self, sql: &str, params: &[Value]) -> Result<Vec<Row>, RelError>
Run a statement and return its rows.
Source§async fn begin(
&self,
isolation: Isolation,
) -> Result<DefectiveTx<'_, R>, RelError>
async fn begin( &self, isolation: Isolation, ) -> Result<DefectiveTx<'_, R>, RelError>
Begin a transaction at (at least)
isolation.Source§fn call_bound(&self) -> Option<Duration>
fn call_bound(&self) -> Option<Duration>
The per-call timeout this backend enforces, if one is configured;
None (the default) means a
call waits as long as the server does. Every call that takes longer returns
RelError::Timeout.Source§fn with_lock_held<'a>(
&'a self,
lock_sql: &'a str,
at_most: Duration,
during: Pin<Box<dyn Future<Output = ()> + Send + 'a>>,
) -> impl Future<Output = Result<(), RelError>> + Send
fn with_lock_held<'a>( &'a self, lock_sql: &'a str, at_most: Duration, during: Pin<Box<dyn Future<Output = ()> + Send + 'a>>, ) -> impl Future<Output = Result<(), RelError>> + Send
Test support for
kv.bounded_call: take lock_sql (a statement that locks a row) in a
transaction of its own, drive during while that lock is held, then roll back. during is
dropped, unfinished, after at_most, so a broken bound cannot hang the test. A backend that
enforces no bound returns RelError::Unsupported.Auto Trait Implementations§
impl<'a, R> Freeze for Defective<'a, R>
impl<'a, R> RefUnwindSafe for Defective<'a, R>where
&'a R: RefUnwindSafe,
impl<'a, R> Send for Defective<'a, R>
impl<'a, R> Sync for Defective<'a, R>
impl<'a, R> Unpin for Defective<'a, R>
impl<'a, R> UnsafeUnpin for Defective<'a, R>where
&'a R: UnsafeUnpin,
impl<'a, R> UnwindSafe for Defective<'a, R>where
&'a R: UnwindSafe,
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