Socket
Socket
Sign inDemoInstall

pd-redis-record

Package Overview
Dependencies
26
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pd-redis-record

(Abandoned) A redis and data model mapping


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

pd-redis-record (Abandoned)

A redis and data model mapping

var Record = require('pd-redis-record');
var modelName = 'user';
var primKeys = ['id'];
var User = Record(modelName, primKeys);

User.amount().then(..);

User.listIds().then(..);

User.rangeIds({
  latest: (new Date()).getTime(),
  earliest: 0
  limit: [0, 20]
}).then(..);

User.getByIdList(idList, {
  fields : ['status', 'firstName'],
  each: function(record){
    //setSthTo(record);
    return record;
  }
}).then(...);

User.getOne('myemail@email.com', {
  fields: ['status', 'firstName']  ,
  withCreatedAt : true  //As creation time is stored in a sorted-set which is different from the record data
                        //it may bring more or less performance loss
}).then(..);

User.range({
  latest : ...,
  earliest : ...,
  limit : ...,
  fields : ....
  //there is no need for withCreatedAt as this function will search both 
  //the data hash and sorted-set index for sure
}).then(..);

User.create({
  id:'johndoe@email.com',
  firstName : 'John',
  lastName : 'Doe'
}).then(...);

User.modify({
  id:'johndoe@email.com',
  firstName : 'Jane',
  lastName : 'Doe'
}).then(...);

User.remove('johndoe@gmail.com').then(...);

User.checkAbsence('johndoe@gmail.com').then(function(){
   //not found
}).then(function(err){
   //found or error
});

User.checkPresence('johndoe@gmail.com').then(function(){
   //found
}).then(function(err){
   //not found or error
});

Keywords

FAQs

Last updated on 23 Apr 2015

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