Skip to content

Introduce .peek() to the Async Iterator API #846

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

Merged
merged 3 commits into from
Jan 26, 2022
Merged

Conversation

bigmontz
Copy link
Contributor

@bigmontz bigmontz commented Jan 25, 2022

This feature allows the user peek the element on the head of the cursor without moving the cursor forward.

The implementation of this feature has as side effect a new implementation .return method in the iterator.
This new version of the method does most the same thing as the previous one, but it also cancels the stream
since this method moves the cursor to the end.

The next method also got tweaked.

This feature allows the user peek the element on the head of the cursor without moving the cursor forward.

The implementation of this feature has as side effect a new implementation `.return` method in the iterator.
This new version of the method does most the same thing as the previous one, but it also cancels the stream
since this method moves the cursor to the end.

The `next` method also get tweaked.
@bigmontz
Copy link
Contributor Author

Depends on: neo4j-drivers/testkit#380

@bigmontz bigmontz requested a review from robsdedude January 25, 2022 16:52
Comment on lines +973 to +974
const it = result[Symbol.asyncIterator]()
const { value: record } = await it.peek()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Usage example

Copy link
Member

@robsdedude robsdedude left a comment

Choose a reason for hiding this comment

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

🚀

@bigmontz bigmontz merged commit 6b48f15 into neo4j:5.0 Jan 26, 2022
@bigmontz bigmontz deleted the 5.0-peek branch January 26, 2022 13:00
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.

2 participants