FedericoCeratto / nim-lmdb

Nim LMDB wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Nim LMDB wrapper

License:Other


Languages

Language:Nim 100.0%