bi-service-bookshelf

0.3.0 • Public • Published

Bookshelf with registry & virtuals & visibility & pagination & paranoia & eloquent plugins.

const Service = require('bi-service');
const config = require('bi-config');
const bookshelfBuilder = require('bi-service-bookshelf');
 
const bookshelf = bookshelfBuilder({/*options*/});
 
const service = new Service(config);
 
//enables integrity inspection features
service.resourceManager.register('postgres', bookshelf);
 
 
//instantiates model definitions and registers them with  the `registry` plugin interface
//returns object with loaded models
bookshelf.loadModels([
    'path/to/directory/with/model/definitions'
]);

Model definition example eg.: lib/models/orm/user.js

 
module.exports = function(bookshelf) {
 
    return bookshelf.Model.extend({
        tableName: 'user'
    });
};

Package Sidebar

Install

npm i bi-service-bookshelf

Weekly Downloads

3

Version

0.3.0

License

GPL-3.0

Unpacked Size

43.6 kB

Total Files

5

Last publish

Collaborators

  • bistudio