pub struct Database<'a> { /* private fields */ }
Expand description
The database instance. Allows you to create rw_transaction and r_transaction, watch queries, and unwatch etc.
§Example
use native_db::*;
fn main() -> Result<(), db_type::Error> {
let builder = DatabaseBuilder::new();
// Define models ...
let db = builder.create_in_memory()?;
// Open transactions
// Watch data
// Create snapshots
// etc...
Ok(())
}
Implementations§
Source§impl Database<'_>
impl Database<'_>
Sourcepub fn rw_transaction(&self) -> Result<RwTransaction<'_>>
pub fn rw_transaction(&self) -> Result<RwTransaction<'_>>
Creates a new read-write transaction.
Sourcepub fn r_transaction(&self) -> Result<RTransaction<'_>>
pub fn r_transaction(&self) -> Result<RTransaction<'_>>
Creates a new read-only transaction.
Auto Trait Implementations§
impl<'a> !Freeze for Database<'a>
impl<'a> !RefUnwindSafe for Database<'a>
impl<'a> Send for Database<'a>
impl<'a> Sync for Database<'a>
impl<'a> Unpin for Database<'a>
impl<'a> !UnwindSafe for Database<'a>
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