libmdbx-0.2.0.0: Bindings for libmdbx, an embedded key/value store
Copyright(c) 2021 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Mdbx.Database

Description

High level API to create, update, delete and query an MDBX database.

Synopsis

Get

getItem Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The key to lookup.

-> m (Maybe v)

The matching value, if any.

Returns the value associated with the given key, if any.

getItems Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> [k]

The keys to lookup.

-> m [v]

The matching values. Length may not match that of keys.

Returns the values associated to a list of keys. Returned length may not match that of provided keys in case some of them are not found.

getRange Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The start of the range (inclusive).

-> k

The end of the range (inclusive).

-> m [v]

The matching values.

Returns the list of values whose keys lie between the provided range.

getRangePairs Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The start of the range (inclusive).

-> k

The end of the range (inclusive).

-> m [(k, v)]

The matching pairs.

Returns the list of key/value pairs whose keys lie between the provided range.

Save

putItem Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The key.

-> v

The value.

-> m () 

Saves the given key/value pair.

putItems Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k, MdbxItem v) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> [(k, v)]

The list of key/value pairs.

-> m () 

Saves the given key/value pairs. Runs in a single transaction.

Delete

delItem Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The key to delete.

-> m () 

Deletes the item associated with the given key, if any.

delItems Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> [k]

The keys to delete.

-> m () 

Deletes the items associated with the given keys, if any. Runs in a single transaction.

delRange Source #

Arguments

:: (MonadIO m, MonadFail m, MdbxItem k) 
=> MdbxEnv

The environment.

-> MdbxDbi

The database.

-> k

The start of the range (inclusive).

-> k

The end of the range (inclusive).

-> m () 

Deletes the values whose keys lie between the provided range.