Node: added zrange and zrangeWithScores commands. - #1115
Conversation
47e00a5 to
71af8de
Compare
barshaul
left a comment
There was a problem hiding this comment.
Why RangeByScoreOrLex isn't separated to two types as we do in python, RangeByScore and RangeByLex? we shouldn't accept ScoreLimit as strings when is lex is false, and we should except number when is lex is true. We also cannot use it later on with the specific zrange functions (e.g. ZRANGEBYLEX). Please follow python's design, and ping me when it's ready for review 🙏
| */ | ||
| type Range<T> = { | ||
| /** | ||
| * The start score boundary. |
There was a problem hiding this comment.
same - it should be used both for lex and score, so the doc might be confusing
| }; | ||
| }; | ||
|
|
||
| export type RangeByScore = Range<number> & { type: "byScore" }; |
There was a problem hiding this comment.
I think "Lex" and "Score" is sufficient for 'type'
|
@barshaul ready |
| * If `key` does not exist, it is treated as an empty sorted set, and the command returns an empty array. | ||
| * | ||
| * @example | ||
| * await client.zadd("mySortedSet", \{ member1: 1.0, member2: 2.0, member3: 3.0 \}); |
There was a problem hiding this comment.
Please follow format for examples:
* @example
* ```typescript
* // Example usage of the echo method
* const echoedMessage = await client.echo("Glide-for-Redis");
* console.log(echoedMessage); // Output: "Glide-for-Redis"
* ```
*/
| * @example | ||
| * await client.zadd("mySortedSet", \{ member1: 1.0, member2: 2.0, member3: 3.0 \}); | ||
| * | ||
| * await client.zrange("mySortedSet", \{ start: 0, stop: -1 \}); |
| export type RangeByScore = SortedSetRange<number> & { type: "byScore" }; | ||
| export type RangeByLex = SortedSetRange<string> & { type: "byLex" }; | ||
|
|
||
| function getScoreLimitArg( |
|
|
||
| function getScoreLimitArg( | ||
| score: ScoreBoundary<number> | ScoreBoundary<string>, | ||
| isLex: boolean = false, |
There was a problem hiding this comment.
please add documentation, this function isn't trivial
--------- Co-authored-by: Adan <adanwat@amazon.com> Co-authored-by: Shoham Elias <shohame@amazon.com> Co-authored-by: Shoham Elias <116083498+shohamazon@users.noreply.github.com>
--------- Co-authored-by: Adan <adanwat@amazon.com> Co-authored-by: Shoham Elias <shohame@amazon.com> Co-authored-by: Shoham Elias <116083498+shohamazon@users.noreply.github.com>
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.