Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

liber

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liber

Shemaless ORMlike library for CouchDB

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

liber

Liber makes using CouchDB not only easier to build but also shemaless. It is built on nano and inspired by AngularJS-Resource. Principles:

  • Minimalistic: Keep functions you would be using(view generation etc.) once out of this one. CouchDB's api is simple - do them using nano.
  • Shemaless: NoSQL is shemaless why should a driver differ.
  • Expectedness: Don't try to squeeze features of a RDBMS out of CouchDB, ergo don't generate anything automatically in the background. Be in control and know whats happening.

Installation

Liber is nothing but a extended api for nano so for using it you also need the latter - it's good to have anyways working with CouchDB:

npm install liber nano

Getting started

to set libre up

var nano = require('nano')('http://localhost:5984/mydatabase');
var Liber = require('liber')(db); //alias for document

now... live a simpler life

Liber.getOne('bobs_id', function (err, bob) {
  bob.age++;
  bob.save(function (err, newBob) {
    //newBob == bob;
  });
});

##Inheritance


<!-- //Liber.inherit(Constructor, prototype, options); where Liber already has a pointer to database. -->

function User(data) {
  this.superClass.call(this, data); // needed to give more flexibility
                                    // to construction process
  this.kind = 'user';
  this.fullName = this.lastName + ', ' + this.firstName;
}

User = Liber.inherit(User, {
  changePassword: function () { ... }
}, {
  'byLastName': ['designDoc', 'viewName']
});

User.get('anId', cb);
/*
  get by id
  Note: Liber doesn't validate the kind or type so you could
  fetch an User from any other Liber class.
*/

User.getByLastName('Smith', cb);
// get user from an generated view getter. Result is an array.

User.getOneByLastName('Smith', cb);
// same as the last one but result is User object.

##API: Class methods

###Libre.inherit ###Libre.parse ###Libre.get ###Libre.getOne ###Libre.getFromView ###Libre.getOneFromView

##API: Instance methods

###Doc.save ###Doc.insert ###Doc.destroy

Keywords

FAQs

Package last updated on 17 Mar 2013

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