Allow for IN, NOT IN, and != queries in postgres
This commit is contained in:
parent
6d33aaaa48
commit
c3dd47f448
|
@ -229,22 +229,31 @@ PG.prototype.toFilter = function (model, filter) {
|
||||||
var sqlCond = key;
|
var sqlCond = key;
|
||||||
switch (condType) {
|
switch (condType) {
|
||||||
case 'gt':
|
case 'gt':
|
||||||
sqlCond += ' > ';
|
sqlCond += ' > ';
|
||||||
break;
|
break;
|
||||||
case 'gte':
|
case 'gte':
|
||||||
sqlCond += ' >= ';
|
sqlCond += ' >= ';
|
||||||
break;
|
break;
|
||||||
case 'lt':
|
case 'lt':
|
||||||
sqlCond += ' < ';
|
sqlCond += ' < ';
|
||||||
break;
|
break;
|
||||||
case 'lte':
|
case 'lte':
|
||||||
sqlCond += ' <= ';
|
sqlCond += ' <= ';
|
||||||
break;
|
break;
|
||||||
case 'between':
|
case 'between':
|
||||||
sqlCond += ' BETWEEN ';
|
sqlCond += ' BETWEEN ';
|
||||||
break;
|
break;
|
||||||
|
case 'inq':
|
||||||
|
sqlCond += ' IN ';
|
||||||
|
break;
|
||||||
|
case 'nin':
|
||||||
|
sqlCond += ' NOT IN ';
|
||||||
|
break;
|
||||||
|
case 'neq':
|
||||||
|
sqlCond += ' != ';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
sqlCond += filterValue;
|
sqlCond += (condType == 'inq' || condType == 'nin') ? '(' + filterValue + ')' : filterValue;
|
||||||
fields.push(sqlCond);
|
fields.push(sqlCond);
|
||||||
} else {
|
} else {
|
||||||
fields.push('"' + key + '" = ' + filterValue);
|
fields.push('"' + key + '" = ' + filterValue);
|
||||||
|
|
Loading…
Reference in New Issue