Narcissistic Pickle Meister
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

chaos-orm

15.0.0 • Public • Published

chaos-orm

Build Status Coverage Status

Chaos is an independent, persistence-agnostic layer responsible for defining entities' business logic and relationships. It allows to describe a Domain Model without any assumption about the persistence layer.

Available datasources libraries:

Chaos dramatically simplify the developpment of a datasources libraries by providing all persistence-agnostic logic like relationships, eager loading at the root level. The only requirement is the datasource you envisionned to use need to be able to fetch a record/document thanks to a unique identifier (i.e no composite primary key).

Install

npm install chaos-orm

Note: Require babel-polyfill as a peer dependency

Main Features

  • Support eager loading
  • Support nested saving
  • Support external & embedded relationship
  • Support custom types & entities' field casting

Example of syntax:

import co from 'co';
import Image from './model/Images';
 
co(function* () {
  // Adding a many-to-many relation
  var image = yield Image.load(123, { 'embed': 'tags' });
  image.push({ name: 'Landscape' });
  yield image.broadcast();
  image.tags.forEach(function(tag) {
    console.log(tag.get('name'));
  }); // Echoes: 'Montain', 'Black&White', 'Landscape'
});

Documentation

See the whole documentation here.

Testing

The spec suite can be runned with:

cd chaos-orm
npm install
npm test

Keywords

install

npm i chaos-orm

Downloadsweekly downloads

32

version

15.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability