Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keydb

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keydb

Key/value data/query API to use on the server and in the browser.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

keydb

Build Status

Key/value data/query API to use on the server or in the browser.

Installation

npm

npm install keydb

Usage

Writes through KeyDB are done with the send method, and reads are done with the query method.

var keydb = require('keydb');

// mysql driver assumes localhost/3306/root
var db = keydb('mysql', 'test');

// upsert
db.send({op: 'set', key: 'foo', value: 'bar'})
  .then(function () {
    // foo is now "bar"
  })
  .then(function () {
    // use funql syntax to query
    return db.query("eq(key,'foo')");
  })
  .then(function (items) {
    // items[0].key === "foo"
    // items[0].value === "bar"
  })
  .finally(function () {
    // disconnect
    return db.end();
  });

You can use set sugar instead of the send method for a set operation, and you can use get sugar to retrieve a single key:

var keydb = require('keydb');

// mysql driver assumes localhost/3306/root
var db = keydb('mysql', 'test');

// upsert
db.set('foo', 'bar')
  .then(function () {
    // foo is now "bar"
  })
  .then(function () {
    return db.get('foo')
  })
  .then(function (item) {
    // items.key === "foo"
    // items.value === "bar"
  })
  .finally(function () {
    // disconnect
    return db.end();
  });

FAQs

Package last updated on 25 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc