npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redadder

v0.3.2

Published

redadder is a simple redis ORM for node.js. It implements simple access to object properties saved in redis, supporting all the redis data-types.

Downloads

4

Readme

Introduction

redadder is a simple redis ORM for node.js. It implements simple access to object properties saved in redis, supporting all the redis data-types.

Features

  • simple schemas
    • attributes
    • indexes
    • object relations
    • basic inheritance
  • queries
  • custom events

Example

var red = require('redadder')(6379); // the port where redis listens
var User = red('user', // the name of the class
  {
    attributes: {
      name: 'string',
      email: 'string',
      sortedSet: 'zset', // neat, but not that useful
      age: 'string', // remember that in redis numbers are strings
      friends: 'users', // user pluralized -> collection of users
      bestFriend: 'user',
      fb: 'string' // for facebook login, or whathaveyou
    },
    indexes: ['fb'] // lets you use User.fetchBy(fbid, 'fb')
  }
);

// NOTE: the following block is an example of what will, soon, be possible to do
User.bind('destroy', function(user) {
  return red.query(User).test('friends', 'includes', user).exec().then(function(users) {
    for(var i = 0, promises = []; i < users.length; i++) {
      users[i].get('friends').remove(user); // lets pretend there's a remove function here...
      promises.push(users[i].save());
    }
    return Q.all(promises);
  });
});

var mark = new User();
mark.save({
  name: 'mark markson',
  email: '[email protected]',
  fb: 12
}).then(function(mark) { console.log(mark.id); }); // redadder uses Q promises

var steve = new User().save({
  name: 'steve',
  email: 'i don\'t have one QQ',
  friends: [mark]
});

steve.bind('change:email', function(user) {
  console.log(user.get('name') + ' changed his email to ' + user.get('email'));
});
steve.set('email', '[email protected]').save();


var Admin = red('admin', User, { // inheritance
  attributes: {},
  indexes: []
});

Future

  • binding events to classes (ie, User.bind('soforth');
  • formal collections (ie, so we can do things like user.get('friends').remove(steve);
  • implement natural functions for zsets, sets, etc. & allow for zsets with object values etc.
  • computed properties