le

0.0.0 • Public • Published

Le db

Generator style node interface to LevelDB.

Usage

var le = require('le');
var co = require('co');
 
var db = le('db');
 
co(function*(){
  yield db.set('foo', 'bar');
  console.log('foo: %s', yield db.get('foo'));
})();

Installation

$ npm install le

Roadmap

  • get, set, delete
  • batches
  • prefix ranges
  • interval ranges
  • test suite
  • streaming iteration
  • encodings
  • plugin interface (no monkey patching!)
  • nesting
  • client

API

db(path)

Create or open the db at path.

db#get*(key)

Get the value at key.

db#set*(key, value)

Set the value at key to value.

db#del*(key)

Delete the value at key.

db#batch()

Create a batch.

batch#set(key, value)

Queue setting key to value.

batch#del(key)

Queue deleting the value at key.

batch#end*()

Write the batch of operations.

db#keys*([range])

Get all keys (inside range).

db#values*([range])

Get all values (whose keys are inside range).

Ranges

db#keys() and db#values() accept string ranges of those formats:

  • ""/"*": get all
  • "prefix*": all keys must start with prefix
  • "[from,to]", "[from,to)", "(from,to]", "(from,to)": all keys must be inside the interval, see interval notations. For infinity to x and vice versa omit the boundary, like [,to].

Encoding

For now, everything is stored as JSON.

Y u do this

  • want db.use() instead of monkey patching
  • generators for async ops
  • generators for streams
  • efficient nesting and less verbose ranges

License

MIT

Dependents (0)

Package Sidebar

Install

npm i le

Weekly Downloads

13

Version

0.0.0

License

MIT

Last publish

Collaborators

  • juliangruber