Closed sobinsunny closed 3 years ago
I think this amounts to a minor edit to src/utils/parser.js
New version:
parser.get_limit_clause = function f(queryObject) {
let limit_clause = '';
Object.keys(queryObject).forEach((k) => {
const queryItem = queryObject[k];
if (k.toLowerCase() === '$limit' || k.toLowerCase() === '$per_partition_limit') {
if (typeof queryItem !== 'number') throw (buildError('model.find.limittype'));
limit_clause = util.format('LIMIT %s', queryItem)
}
if (k.toLowerCase() === '$per_partition_limit') {
limit_clause = 'PER PARTITION ' + limit_clause;
}
});
return limit_clause;
};
I'm aspiring to test and put in a PR, but I'm juggling many other things and want to share this in case I get too distracted and forget to follow through.
@josiahjohnston thanks for the code, I've used this code along with some added tests to create a new release. v2.5.0
Thanks for being so amazingly responsive!
I'd be more flexibile if we can add PER PARTITION LIMIT operator in query