sql-kit
Introduction
a lib to parser sql-string
Reference
Very useful toolkit for SQL - WHERE & ORDER BY & LIMIT
Usage
CommonJS
let sqlKit = require('sql-query');
new sqlKit({
query:{
$eq$status:1,
$gte$money:10,
$lte$money:100
},
sort:['-created'],
meta:{
limit:10,
page:0,
skip:0
}
})
Angular
require('sql-query');
angular.module('myApp',['ui.router','sql-query'])
.controller('main',function(sqlKit){
sqlKit({
query:{
$eq$status:1,
$gte$money:10,
$lte$money:100
},
sort:['-created'],
meta:{
limit:10,
page:0,
skip:0
}
});
})
Advance Usage
// support endless nest in query
new sqlKit({
query:{
$eq$status:1,
$gte$money:10,
$lte$money:100,
$or$and$eq$currency:'USD',
$or$and$gt$money:100
},
sort:['-created'],
meta:{
limit:10,
page:0,
skip:0
}
})