Socket
Socket
Sign inDemoInstall

dionne-davenport

Package Overview
Dependencies
121
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dionne-davenport

PostgresSQL backed key/val store with support for JSON values and key expiration


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
9.09 MB
Created
Weekly downloads
 

Readme

Source

Dionne Davenport

circle-status

js-standard-style

Essentially hstore with JSON val

$ npm install dionne-davenport --save

Basic setting/getting

const Dionne = require('dionne-davenport')
const opts = {
  appName: 'myApp',
  url: process.env.DATABASE_URL
}
const store = await Dionne(opts)
await store.set('as', 'if')
const result = await store.get('as')
console.log(result) // 'if'

Batch setting/getting

const items = {
  foo: 'bar',
  ping: {
    beep: [ 'boop', 'bop' ]
  }
}
await store.setAll(items)
const result = await store.getAll(Object.keys(items))
console.log(result)
/*
{
  foo: 'bar',
  ping: {
    beep: [ 'boop', 'bop' ]
  }
}
*/

Deletion

let item
await store.set('delMe', 'foo')
item = await store.get('delMe')
console.log('delMe') // foo

await store.del('delMe')
item = await store.get('delMe')
console.log(item) // undefined

Tests

Create your test PostgresSQL database and user and create a test.env file for environment constiables

$ createuser myApp
$ createdb myApp
$ echo "DATABASE_URL=postgres://myApp:Ffoodk@localhost:5432/myApp" >> test/test.env
$ echo "NODE_ENV=test" >> test/test.env
$ echo "APP_NAME=appName" >> test/test.env
$ npm test

FAQs

Last updated on 18 Apr 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc