json-sql
Version:
node.js json to sql queries mapper
22 lines (18 loc) • 472 B
JavaScript
;
var _ = require('underscore');
module.exports = function(dialect) {
dialect.operators.fetching.add('$json', {
fn: function(value, end) {
if (end) value = {value: value};
return dialect.buildBlock('term', {term: value, type: 'value'});
}
});
dialect.operators.fetching.add('$array', {
fn: function(value) {
if (!_.isArray(value)) {
value = [value];
}
return dialect.buildBlock('term', {term: value, type: 'value'});
}
});
};