🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

pd-redis-record

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pd-redis-record

(Abandoned) A redis and data model mapping

0.1.2
latest
Version published
Weekly downloads
1
-83.33%
Maintainers
1
Weekly downloads
 
Created

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
});

FAQs

Package last updated on 23 Apr 2015

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