Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node: Add XRANGE command #2069

Merged
merged 21 commits into from
Aug 14, 2024

Conversation

jonathanl-bq
Copy link
Collaborator

@jonathanl-bq jonathanl-bq commented Aug 1, 2024

Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
@jonathanl-bq jonathanl-bq marked this pull request as ready for review August 1, 2024 20:10
@jonathanl-bq jonathanl-bq requested a review from a team as a code owner August 1, 2024 20:10
* ```typescript
* await client.xadd("mystream", [["field1", "value1"]], {id: "0-1"});
* await client.xadd("mystream", [["field2", "value2"], ["field2", "value3"]], {id: "0-2"});
* const result = await client.xrange("mystream", "-", "+");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* const result = await client.xrange("mystream", "-", "+");
* console.log(await client.xrange("mystream", "-", "+"));

node/src/Commands.ts Outdated Show resolved Hide resolved
node/src/Commands.ts Outdated Show resolved Hide resolved
node/src/Commands.ts Outdated Show resolved Hide resolved
* See https://valkey.io/commands/xrange for more details.
*
* @param key - The key of the stream.
* @param start - The starting stream ID bound for the range.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mention what id is for the range bound?

Copy link
Collaborator

@tjzhang-BQ tjzhang-BQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good with Andrew's comments addressed

node/src/Commands.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
node/src/Commands.ts Outdated Show resolved Hide resolved
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
Signed-off-by: Jonathan Louie <[email protected]>
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/Transaction.ts Outdated Show resolved Hide resolved
@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented Aug 13, 2024

From docs:

History

  • Starting with Redis version 6.2.0: Added exclusive ranges.

You need to reflect this in docs and in tests

@jonathanl-bq
Copy link
Collaborator Author

From docs:

History

  • Starting with Redis version 6.2.0: Added exclusive ranges.

You need to reflect this in docs and in tests

Well this is getting kind of frustrating. I'm following the Python tests and there's two things that stand out to me. They use numbers for timestamps for one thing, which apparently isn't how they're specified according to your previous comment. Secondly, this check for the Redis version isn't actually in the Python xrange tests at all.

Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Please, polish the docs and go on.

node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
node/src/Transaction.ts Outdated Show resolved Hide resolved
node/src/BaseClient.ts Outdated Show resolved Hide resolved
* ```typescript
* await client.xadd("mystream", [["field1", "value1"]], {id: "0-1"});
* await client.xadd("mystream", [["field2", "value2"], ["field2", "value3"]], {id: "0-2"});
* console.log(await client.xrange("mystream", "-", "+"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the example to use the enum properly.

* - Use `InfBoundary.PositiveInfinity` to end with the maximum available ID.
* @param count - An optional argument specifying the maximum count of stream entries to return.
* If `count` is not provided, all stream entries in the range will be returned.
* @returns A map of stream entry ids, to an array of entries.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell when it return null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/valkey-io/valkey-glide/pull/1920/files I guess this should've added documentation for the Java client about the null case when it was fixed? It certainly doesn't seem to be there right now on main.

*/
export type ScoreBoundary<T> =
export type Boundary<T> =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Signed-off-by: Jonathan Louie <[email protected]>
@jonathanl-bq jonathanl-bq merged commit edcb15a into valkey-io:main Aug 14, 2024
8 checks passed
@jonathanl-bq jonathanl-bq deleted the node/lotjonat-XRANGE-valkey-60 branch August 14, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants