@rule.js/knex
v0.17.1
Published
Serializable object assertions.
Downloads
4
Maintainers
Readme
Rule.js: KnexJs Module
Use your rule.js conditions with KnexJs!
Example:
const Rule = require('@rule.js/core').extend({}, {
knex: require('@rule.js/knex')()
})
const knex = require('knex')({ client: 'pg' })
knex('user')
.select()
.where(function() {
Rule().equal('name', 'Joe Pass').knex(this)
})
Note: This module automatically converts keys to snake case. If you don't want it to do this, you can override it with:
const Rule = require('@rule.js/core').extend({}, {
knex: require('@rule.js/knex')(function(key) { return key })
})