0.1.5 • Published 8 years ago

bookshelf-flexi-where v0.1.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

bookshelf-flexi-where

A more flexible way to build where statements in bookshelf.

Installation

npm i --save bookshelf-flexi-where

Usage

import flexiWhere from 'bookshelf-flexi-where';

// Register the plugin
Bookshelf.plugin(flexiWhere);

const opts = [
  {
    column: 'email',
    operator: 'like',
    value: '%tripvisto%',
  },
  {
    column: 'username',
    operator: '=',
    value: 'wingski',
  },
];
User.forge()
  .flexiWhere(opts)
  .fetchAll()
  .then(result => {
    expect(result.size(), 1);
    expect(result.at(0).get('email')).include('tripvisto');
    expect(result.at(0).get('username')).include('wingski');
  })
  .then(() => done())
  .catch(err => done(err));

License

MIT

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago