0.4.0 • Published 10 years ago

keev v0.4.0

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

keev

Minimalist Key Value store with a Streaming api.

build status

Installation

This module is installed via npm:

$ npm install keev

Example Usage

var stdout = require('stdout');

var db = require('keev')();

var dbStream = db.createStream();

dbStream.pipe(stdout()); // Just spit it to the console

dbStream.write({ a: 10 }); // Store a=10
dbStream.write({ a: null }); // Query for the value of a
dbStream.write({ a: "foo" }); // Store a="foo"
dbStream.write({ a: undefined }); // Delete a from store
dbStream.write({ a: null }); // Succeeds in not returning the key a

API

var db = require('keev')({options});

options.store is a an object with the following methods. If a store it not given, it will assume a memory store.

A store must implement:

getAll(keys, cb)

where cb is a callback that with the signature function(err, obj). For each key passed in the object will have a property, if a value is not found, it's value will be undefined.

putAll(obj, cb)

where cb is a callback that with the signature function(err). For each key in the object, the store should delete the key if the value given is undefined, or set it otherwise.

Keev.createStream() Returns a stream which when written to supports querying, deleting, and putting.

Keev.createQueryStream() Returns a stream which only queries for values where the value of properties is null, passing all others through without change.

Keev.createChangeStream() Returns a stream which applies all changes, but passing through any properties with null values unchanged.

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago