pub trait DatabaseCollection: Sync + Send {
    // Required methods
    fn get(&self, key: &str) -> Result<Vec<u8>, Error>;
    fn put(&self, key: &str, data: Vec<u8>) -> Result<(), Error>;
    fn del(&self, key: &str) -> Result<(), Error>;
    fn iter<'a>(
        &'a self,
        reverse: bool,
        prefix: String
    ) -> Box<dyn Iterator<Item = (String, Vec<u8>)> + 'a>;
}
Expand description

A trait representing a collection of key-value pairs in a database.

Required Methods§

source

fn get(&self, key: &str) -> Result<Vec<u8>, Error>

Retrieves the value associated with the given key.

source

fn put(&self, key: &str, data: Vec<u8>) -> Result<(), Error>

Associates the given value with the given key.

source

fn del(&self, key: &str) -> Result<(), Error>

Removes the value associated with the given key.

source

fn iter<'a>( &'a self, reverse: bool, prefix: String ) -> Box<dyn Iterator<Item = (String, Vec<u8>)> + 'a>

Returns an iterator over the key-value pairs in the collection.

Implementors§