Struct keyvaluedb_sqlite::Database
source · pub struct Database { /* private fields */ }
Implementations§
source§impl Database
impl Database
pub fn open_with_columns<P: AsRef<Path>>(path: P, columns: u32) -> Result<Self>
pub fn open_in_memory_with_columns<P: AsRef<Path>>( path: P, columns: u32 ) -> Result<Self>
pub fn path(&self) -> PathBuf
pub fn config(&self) -> DatabaseConfig
sourcepub fn num_columns(&self) -> Result<u32>
pub fn num_columns(&self) -> Result<u32>
Low level operations
sourcepub fn remove_last_column(&self) -> Result<()>
pub fn remove_last_column(&self) -> Result<()>
Remove the last column family in the database. The deletion is definitive.
sourcepub fn add_column(&self) -> Result<()>
pub fn add_column(&self) -> Result<()>
Add a new column family to the DB.
sourcepub fn transaction(&self) -> DBTransaction
pub fn transaction(&self) -> DBTransaction
Helper to create new transaction for this database.
Trait Implementations§
source§impl KeyValueDB for Database
impl KeyValueDB for Database
source§fn delete<'a>(
&self,
col: u32,
key: &'a [u8]
) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
fn delete<'a>( &self, col: u32, key: &'a [u8] ) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
Remove a value by key, returning the old value
source§fn get<'a>(
&self,
col: u32,
key: &'a [u8]
) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
fn get<'a>( &self, col: u32, key: &'a [u8] ) -> Pin<Box<dyn Future<Output = Result<Option<DBValue>>> + Send + 'a>>
Get a value by key.
source§fn write(
&self,
transaction: DBTransaction
) -> Pin<Box<dyn Future<Output = Result<(), DBTransactionError>> + Send + 'static>>
fn write( &self, transaction: DBTransaction ) -> Pin<Box<dyn Future<Output = Result<(), DBTransactionError>> + Send + 'static>>
Write a transaction of changes to the backing store.
source§fn iter<'a, T: 'a, F: FnMut(DBKeyValueRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>(
&self,
col: u32,
prefix: Option<&'a [u8]>,
f: F
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
fn iter<'a, T: 'a, F: FnMut(DBKeyValueRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>( &self, col: u32, prefix: Option<&'a [u8]>, f: F ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
Iterate over the data for a given column.
Return all key/value pairs, optionally where the key starts with the given prefix.
Iterator closure returns true for more items, false to stop iteration.
source§fn iter_keys<'a, T: 'a, F: FnMut(DBKeyRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>(
&self,
col: u32,
prefix: Option<&'a [u8]>,
f: F
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
fn iter_keys<'a, T: 'a, F: FnMut(DBKeyRef<'_>) -> Result<Option<T>> + Send + Sync + 'a>( &self, col: u32, prefix: Option<&'a [u8]>, f: F ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'a>>
Iterate over the data for a given column.
Return all keys, optionally where the key starts with the given prefix.
Iterator closure returns true for more items, false to stop iteration.
source§fn restore(&self, _new_db: &str) -> Result<()>
fn restore(&self, _new_db: &str) -> Result<()>
Attempt to replace this database with a new one located at the given path.
source§fn transaction(&self) -> DBTransaction
fn transaction(&self) -> DBTransaction
Helper to create a new transaction.
source§fn has_key<'a>(
&self,
col: u32,
key: &'a [u8]
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'a, Global>>
fn has_key<'a>( &self, col: u32, key: &'a [u8] ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'a, Global>>
Check for the existence of a value by key.
Auto Trait Implementations§
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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