diff options
author | shacharPash <93581407+shacharPash@users.noreply.github.com> | 2023-04-30 14:57:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-30 14:57:27 +0300 |
commit | bf528fc7f776ce8e926b2e9abfa4e2460d73baa4 (patch) | |
tree | df3c61e3fcc8d31d4a1d5ea598ad4d01e67dd7e5 /redis/commands/core.py | |
parent | 8b58ebb73e03970fade4d3f9e2c961831713c228 (diff) | |
download | redis-py-bf528fc7f776ce8e926b2e9abfa4e2460d73baa4.tar.gz |
Add WITHSCORES to ZREVRANK Command (#2725)
* add withscores to zrevrank
* change 0 -> 2
* fix errors
* split test
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r-- | redis/commands/core.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index e2cabb8..d67291b 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -4693,13 +4693,22 @@ class SortedSetCommands(CommandsProtocol): """ return self.execute_command("ZREMRANGEBYSCORE", name, min, max) - def zrevrank(self, name: KeyT, value: EncodableT) -> ResponseT: + def zrevrank( + self, + name: KeyT, + value: EncodableT, + withscore: bool = False, + ) -> ResponseT: """ Returns a 0-based value indicating the descending rank of - ``value`` in sorted set ``name`` + ``value`` in sorted set ``name``. + The optional ``withscore`` argument supplements the command's + reply with the score of the element returned. For more information see https://redis.io/commands/zrevrank """ + if withscore: + return self.execute_command("ZREVRANK", name, value, "WITHSCORE") return self.execute_command("ZREVRANK", name, value) def zscore(self, name: KeyT, value: EncodableT) -> ResponseT: |