Skip to content

admazely/resourceful-riak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#resourceful-riak Build Status

A Riak engine to the resourceful model framework from flatiron.

Acknowledgement

resourceful-riak builds heavily on the code from the couchdb engine included in resourceful.

Example

This is the example from resourceful, adapted to work with resourceful-riak.

  var resourceful = require('resourceful');
  require('resourceful-riak');
  
  var Creature = resourceful.define('creature', function () {
    //
    // Specify a storage engine
    //
    this.use('riak', {
      bucket: "creatures" // bucket must always be set when using the riak engine
    });
    
    //
    // Specify some properties with validation
    //
    this.property('diet'); // Defaults to String
    this.property('vertebrate', Boolean);
    this.property('belly', Array);
  });
  
  //
  // Now that the `Creature` prototype is defined
  // we can add custom logic to be available on all instances
  //
  Creature.prototype.feed = function (food) {
    this.belly.push(food);
  };

Motivation

Resourceful is a simple yet powerful model framework from the infamous heroes at nodejitsu. Sadly it didn't support Riak (which we use extensively at admaze.ly), so we fixed that.

API Documentation

Today, resourceful-riak support all of the creation, deletion and modifyfing methods that resourceful supply (se README.md from resourceful for details). Going forward, we hope to implement both more advanced resourceful functionality (like filters and relationships) as well as riak-specific futures (like links and secondary indexes).

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing resourceful

  $ [sudo] npm install resourceful

Installing resourceful-riak

  $ [sudo] npm install resourceful-riak

Tests

All tests are written with [vows][0] and should be run with [npm][1]:

  $ npm test

License: Apache 2.0

Releases

No releases published

Packages

No packages published