Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Latest commit

 

History

History
59 lines (41 loc) · 1.44 KB

README.adoc

File metadata and controls

59 lines (41 loc) · 1.44 KB

Nim LMDB

badge tags License CircleCI

Nim wrapper for the Symas LMDB library

"…​with only 32KB of object code, LMDB may seem tiny. But it’s the right 32KB." - from the LMDB home page.

More documentation: upstream docs - wikipedia page - exploring LMDB

Features

  • Lightweight and ultra fast

  • nim doc documentation

  • Basic functional tests and benchmarks

  • Tested on Linux

Usage

# Development library:
nimble install lmdb

# Runtime dependency:
sudo apt-get install liblmdb0
import lmdb

# create dbenv, transaction and a dbi
let dbenv = newLMDBEnv("./testdb")
let txn = dbenv.newTxn()
let dbi = txn.dbiOpen(nil, 0)

txn.put(dbi, "foo", "value")
let g = txn.get(dbi, "foo")
txn.del(dbi, "foo", "value")

# commit or abort transaction
txn.commit() # or txn.abort()

# close dbi and env
dbenv.close(dbi)
dbenv.envClose()

Also see tests/functional.nim for more examples.

Contributing

Testing and PRs are welcome.