Struct schemer_rusqlite::RusqliteAdapter
source · pub struct RusqliteAdapter<'a, E> { /* private fields */ }
Expand description
Adapter between schemer and SQLite.
Implementations
sourceimpl<'a, E> RusqliteAdapter<'a, E>
impl<'a, E> RusqliteAdapter<'a, E>
sourcepub fn new(
conn: &'a mut Connection,
table_name: Option<String>
) -> RusqliteAdapter<'a, E>
pub fn new(
conn: &'a mut Connection,
table_name: Option<String>
) -> RusqliteAdapter<'a, E>
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<RusqliteError> = 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, E: From<RusqliteError> + Sync + Send + Error + 'static> Adapter for RusqliteAdapter<'a, E>
impl<'a, E: From<RusqliteError> + Sync + Send + Error + 'static> Adapter for RusqliteAdapter<'a, E>
type MigrationType = dyn RusqliteMigration<Error = E> + 'static
type MigrationType = dyn RusqliteMigration<Error = E> + 'static
Type migrations must implement for this adapter.
type Error = E
type Error = E
Type of errors returned by this adapter.
sourcefn applied_migrations(&mut self) -> Result<HashSet<Uuid>, Self::Error>
fn applied_migrations(&mut 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, E> !RefUnwindSafe for RusqliteAdapter<'a, E>
impl<'a, E> Send for RusqliteAdapter<'a, E>where
E: Send,
impl<'a, E> !Sync for RusqliteAdapter<'a, E>
impl<'a, E> Unpin for RusqliteAdapter<'a, E>where
E: Unpin,
impl<'a, E> !UnwindSafe for RusqliteAdapter<'a, E>
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