Struct schemer_rusqlite::RusqliteAdapter
source · pub struct RusqliteAdapter<'a> { /* private fields */ }
Expand description
Adapter between schemer and SQLite.
Implementations
sourceimpl<'a> RusqliteAdapter<'a>
impl<'a> RusqliteAdapter<'a>
sourcepub fn new(
conn: &'a mut Connection,
table_name: Option<String>
) -> RusqliteAdapter<'a>
pub fn new(
conn: &'a mut Connection,
table_name: Option<String>
) -> RusqliteAdapter<'a>
Construct a SQLite schemer adapter.
table_name
specifies the name of the table that schemer will use
for storing metadata about applied migrations. If None
, a default
will be used.
let mut conn = rusqlite::Connection::open_in_memory().unwrap();
let adapter = schemer_rusqlite::RusqliteAdapter::new(&mut conn, None);
sourcepub fn init(&self) -> Result<(), RusqliteError>
pub fn init(&self) -> Result<(), RusqliteError>
Initialize the schemer metadata schema. This must be called before
using Migrator
with this adapter. This is safe to call multiple times.
Trait Implementations
sourceimpl<'a> Adapter for RusqliteAdapter<'a>
impl<'a> Adapter for RusqliteAdapter<'a>
type MigrationType = dyn RusqliteMigration + 'static
type MigrationType = dyn RusqliteMigration + 'static
Type migrations must implement for this adapter.
sourcefn applied_migrations(&self) -> Result<HashSet<Uuid>, Self::Error>
fn applied_migrations(&self) -> Result<HashSet<Uuid>, Self::Error>
Returns the set of IDs for migrations that have been applied.
sourcefn apply_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
fn apply_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
Apply a single migration.
sourcefn revert_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
fn revert_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
Revert a single migration.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for RusqliteAdapter<'a>
impl<'a> Send for RusqliteAdapter<'a>
impl<'a> !Sync for RusqliteAdapter<'a>
impl<'a> Unpin for RusqliteAdapter<'a>
impl<'a> !UnwindSafe for RusqliteAdapter<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more