pub struct MigrationContext { /* private fields */ }Expand description
Context passed to migration functions. Provides put/get/delete against the module’s schema tree and access to the database for opening other trees.
Migrations run locally in the module process. Use put/get/delete for schema metadata.
For application data migrations, use open_tree to open and migrate other trees.
Implementations§
Source§impl MigrationContext
impl MigrationContext
Sourcepub fn new(tree: Arc<dyn Tree>, db: Arc<dyn Database>) -> Self
pub fn new(tree: Arc<dyn Tree>, db: Arc<dyn Database>) -> Self
Create a new MigrationContext wrapping the schema tree and database.
Sourcepub fn put(&self, key: &[u8], value: &[u8]) -> Result<()>
pub fn put(&self, key: &[u8], value: &[u8]) -> Result<()>
Insert a key-value pair into the schema tree.
Trait Implementations§
Source§impl Clone for MigrationContext
impl Clone for MigrationContext
Source§fn clone(&self) -> MigrationContext
fn clone(&self) -> MigrationContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MigrationContext
impl !RefUnwindSafe for MigrationContext
impl Send for MigrationContext
impl Sync for MigrationContext
impl Unpin for MigrationContext
impl UnsafeUnpin for MigrationContext
impl !UnwindSafe for MigrationContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more