Add novalues option to command HSCAN.#12765
Conversation
zuiderkwast
left a comment
There was a problem hiding this comment.
Nice!
Maybe we need to modify the reply schema in hscan.json? At least the description which says "list of key/value pairs from the hash where each even element is the key, and each odd element is the value".
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast
left a comment
There was a problem hiding this comment.
Good, I have no more comments.
Some of the my comments apply to the ZSCAN NOSCORES PR too, for example the reply schema and the error message.
|
@oranagra @itamarhaber please approve, this is not a major decision, but I'd like to have your agreement on the command's format. |
|
It was discussed in the other thread, but why did we decide to ignore the consideration about changing the return structure of this command? I think that should be a non-starter for this command, and would prefer extending |
|
approved in a core-team meeting |
|
@CharlesChen888 is this ready to be merged? (it seems so to me) |
|
@oranagra I think this is ready. redis/redis-doc#2612 The corresponding PR to doc is here, I will delete the ZSCAN part. |
Add a way to HSCAN a hash key, and get only the filed names. Command syntax is now: ``` HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES] ``` when `NOVALUES` is on, the command will only return keys in the hash. --------- Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Doc of redis/redis#12765. --------- Co-authored-by: Oran Agra <oran@redislabs.com>
Command syntax is now: ``` ZSCAN key cursor [MATCH pattern] [COUNT count] [NOSCORES] ``` Return format: ``` 127.0.0.1:6379> zadd z 1 a 2 b 3 c (integer) 3 127.0.0.1:6379> zscan z 0 1) "0" 2) 1) "a" 2) "1" 3) "b" 4) "2" 5) "c" 6) "3" 127.0.0.1:6379> zscan z 0 noscores 1) "0" 2) 1) "a" 2) "b" 3) "c" ``` when NOSCORES is on, the command will only return members in the zset, without scores. For client side parsing the command return, I believe it is fine as long as the command is backwards compatible. The return structure are still lists, what has changed is the content. And clients can tell the difference by the subcommand they use. Since `novalues` option of `HSCAN` is already accepted (redis/redis#12765), I think similar thing can be done to `ZSCAN`. --------- Signed-off-by: Chen Tianjie <TJ_Chen@outlook.com>
Command syntax is now: ``` ZSCAN key cursor [MATCH pattern] [COUNT count] [NOSCORES] ``` Return format: ``` 127.0.0.1:6379> zadd z 1 a 2 b 3 c (integer) 3 127.0.0.1:6379> zscan z 0 1) "0" 2) 1) "a" 2) "1" 3) "b" 4) "2" 5) "c" 6) "3" 127.0.0.1:6379> zscan z 0 noscores 1) "0" 2) 1) "a" 2) "b" 3) "c" ``` when NOSCORES is on, the command will only return members in the zset, without scores. For client side parsing the command return, I believe it is fine as long as the command is backwards compatible. The return structure are still lists, what has changed is the content. And clients can tell the difference by the subcommand they use. Since `novalues` option of `HSCAN` is already accepted (redis/redis#12765), I think similar thing can be done to `ZSCAN`. --------- Signed-off-by: Chen Tianjie <TJ_Chen@outlook.com>
Add a way to HSCAN a hash key, and get only the filed names. Command syntax is now: ``` HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES] ``` when `NOVALUES` is on, the command will only return keys in the hash. --------- Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Add a way to HSCAN a hash key and get only the field names. To resolve #12749
Command syntax is now:
when
NOVALUESis on, the command will only return keys in the hash.