Allow lex min and max to be inclusive or exclusive.

This commit is contained in:
yariplus
2016-10-16 21:29:45 -04:00
parent 437d2744cc
commit 1bb44e2429
2 changed files with 34 additions and 16 deletions

View File

@@ -311,20 +311,22 @@ module.exports = function (redisClient, module) {
function sortedSetLex(method, reverse, key, min, max, start, count, callback) {
if (!callback) callback === start;
var minmin, maxmax;
if (reverse) {
if (min !== '+') {
min = '(' + min;
}
if (max !== '-') {
max = '[' + max;
}
minmin = '+';
maxmax = '-';
} else {
if (min !== '-') {
min = '[' + min;
}
if (max !== '+') {
max = '(' + max;
}
minmin = '-';
maxmax = '+';
}
if (min !== minmin) {
min = '' + min;
if (!min.match(/[\[\(]/)) min = '[' + min;
}
if (max !== maxmax) {
max = '' + max;
if (!max.match(/[\[\(]/)) max = '[' + max;
}
if (count) {