diff options
Diffstat (limited to 'redis/client.py')
-rwxr-xr-x | redis/client.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/redis/client.py b/redis/client.py index 160f495..ea36ef0 100755 --- a/redis/client.py +++ b/redis/client.py @@ -2866,7 +2866,8 @@ class Redis: return self.execute_command('XTRIM', name, *pieces) # SORTED SET COMMANDS - def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False): + def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False, + gt=None, lt=None): """ Set any number of element-name, score pairs to the key ``name``. Pairs are specified as a dict of element-names keys to score values. @@ -2897,6 +2898,9 @@ class Redis: if incr and len(mapping) != 1: raise DataError("ZADD option 'incr' only works when passing a " "single element/score pair") + if nx is True and (gt is not None or lt is not None): + raise DataError("Only one of 'nx', 'lt', or 'gr' may be defined.") + pieces = [] options = {} if nx: @@ -2908,6 +2912,10 @@ class Redis: if incr: pieces.append(b'INCR') options['as_score'] = True + if gt: + pieces.append(b'GT') + if lt: + pieces.append(b'LT') for pair in mapping.items(): pieces.append(pair[1]) pieces.append(pair[0]) |