pub struct SqliteDatabase { /* private fields */ }Expand description
An open SQLite database (file path or :memory:).
Implementations§
Source§impl SqliteDatabase
impl SqliteDatabase
Source§impl SqliteDatabase
impl SqliteDatabase
Sourcepub fn apply_migrations(
&self,
module: &str,
migrations: &[SqlMigration],
) -> Result<(), DbError>
pub fn apply_migrations( &self, module: &str, migrations: &[SqlMigration], ) -> Result<(), DbError>
Applies a module’s unapplied migrations in order, tracked under
<module>/<id> in a harness_migrations table; each migration
runs in its own transaction so a failure rolls back atomically and
re-running is idempotent.
§Errors
DbError::Batch when a migration’s SQL fails.
§Panics
Only if the connection mutex is poisoned by a prior panic.
Trait Implementations§
Source§impl Database for SqliteDatabase
impl Database for SqliteDatabase
Source§fn batch_atomic<'life0, 'life1, 'async_trait>(
&'life0 self,
stmts: &'life1 [Statement],
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn batch_atomic<'life0, 'life1, 'async_trait>(
&'life0 self,
stmts: &'life1 [Statement],
) -> Pin<Box<dyn Future<Output = Result<(), DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Runs all statements in one transaction (atomic on SQLite).
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
stmt: &'life1 Statement,
) -> Pin<Box<dyn Future<Output = Result<u64, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
stmt: &'life1 Statement,
) -> Pin<Box<dyn Future<Output = Result<Rows, DbError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for SqliteDatabase
impl RefUnwindSafe for SqliteDatabase
impl Send for SqliteDatabase
impl Sync for SqliteDatabase
impl Unpin for SqliteDatabase
impl UnsafeUnpin for SqliteDatabase
impl UnwindSafe for SqliteDatabase
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