Numerous Packages Multiply
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    chaos-ormpublic

    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

    Downloadslast 7 days

    10

    version

    14.0.6

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar