New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shelf

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shelf

Redis Object Document Mapper (ODM)

  • 2.1.1
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-85.71%
Maintainers
3
Weekly downloads
 
Created
Source

shelf Logo

Object Document Mapper (ODM) for Node.js who uses Redis as its store.

Build Status npm version

Introduction

If you need to store complex objects do Redis, but don't want to go through the trouble of translating your objects to a key, value store, then Shelf is for you. Shelf gives you CRUD operation on your objects over Redis, so you can create complex schemas and validate models.

Shelf uses joi for schema validation.

If you're using 0.10 or 0.12 node version, please use shelf@1. You can also look at the code at the 1.x.x branch.

Example

const Shelf = require('shelf')
const Joi = require('joi')

const Storage = Shelf('MyApp', {
  port: 6379,
  host: '127.0.0.1'
})

const MyModel = Storage.extend({
  name: 'MySchema',
  props: Joi.object().keys({
    prop1: Joi.string(),
    prop2: Joi.string()
  }),
  keys: ['prop1']
})

let myModel = MyModel({prop1: 'Hello'})

myModel.save()

You can (and should) move your DB connection (Shelf) and Schema (returned by the extend method) to different files to get better readability.

Check the examples for further information.

Contributing

We use standard js.

In order to run the tests you should have an Redis instance running locally.

Keywords

FAQs

Package last updated on 18 Mar 2016

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