Struct lmdb_rs::core::Database [] [src]

pub struct Database<'a> {
    // some fields omitted
}

Database

Methods

impl<'a> Database<'a>
[src]

fn get<V: FromMdbValue + 'a>(&'a self, key: &ToMdbValue) -> MdbResult<V>

Retrieves a value by key. In case of DbAllowDups it will be the first value

fn set<K: ToMdbValue, V: ToMdbValue>(&self, key: &K, value: &V) -> MdbResult<()>

Sets value for key. In case of DbAllowDups it will add a new item

fn del<K: ToMdbValue>(&self, key: &K) -> MdbResult<()>

Deletes value for key.

fn del_item(&self, key: &ToMdbValue, data: &ToMdbValue) -> MdbResult<()>

Should be used only with DbAllowDups. Deletes corresponding (key, value)

fn new_cursor(&'a self) -> MdbResult<Cursor<'a>>

Returns a new cursor

fn del_db(self) -> MdbResult<()>

Deletes current db, also moves it out

fn clear(&self) -> MdbResult<()>

Removes all key/values from db

fn iter(&'a self) -> MdbResult<CursorIterator<'a, CursorIter>>

Returns an iterator for all values in database

fn keyrange_from<'c, K: ToMdbValue + 'c>(&'c self, start_key: &'c K) -> MdbResult<CursorIterator<'c, CursorFromKeyIter>>

Returns an iterator through keys starting with start_key (>=), start_key is included

fn keyrange_to<'c, K: ToMdbValue + 'c>(&'c self, end_key: &'c K) -> MdbResult<CursorIterator<'c, CursorToKeyIter>>

Returns an iterator through keys less than end_key, end_key is not included

fn keyrange<'c, K: ToMdbValue + 'c>(&'c self, start_key: &'c K, end_key: &'c K) -> MdbResult<CursorIterator<'c, CursorKeyRangeIter>>

Returns an iterator for values between start_key and end_key (included). Currently it works only for unique keys (i.e. it will skip multiple items when DB created with ffi::MDB_DUPSORT). Iterator is valid while cursor is valid

fn item_iter<'c, 'db: 'c, K: ToMdbValue>(&'db self, key: &'c K) -> MdbResult<CursorIterator<'c, CursorItemIter<'c>>>

Returns an iterator for all items (i.e. values with same key)