Skip to content

Simplify bookmark impl by exposing internal values #649

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 2 commits into from
Nov 18, 2019

Conversation

zhenlineo
Copy link
Contributor

@zhenlineo zhenlineo commented Nov 17, 2019

This makes serialization of the bookmark easier to end users.
End users could serialize and deserialize bookmark in whatever way they like using Set<String> values

Bookmark is defined as follows:

Bookmark {
Set<String> values(); // can be used to serialize bookmark
static Bookmark parse(Set<String> values); // can be used to deserialize bookmark
boolean isEmpty();
}

This makes serialization of the bookmark easier to end users.
End users could serialize and deserialize bookmark in whatever way they like using `Set<String> values`
Copy link
Contributor

@michael-simons michael-simons left a comment

Choose a reason for hiding this comment

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

I'd remove static Bookmark merge(Iterable<String> bookmarks); to avoid confusion. It's not needed with .parse and .merge in combination and clutters API (at least to me, maybe that's personal taste).

I'm also a bit confused as I thought we spoke about dumping the bookmarks as byte[] from the driver.

@zhenlineo
Copy link
Contributor Author

@michael-simons Very good input on the merge methods. Would you think this API will be good enough for your use case if we have merge methods removed?

We talked about toBytes, but it is not very idiomatic to Javascript, where most of objects are directly visible to users. .Net driver gives this solution which gives me some new thoughts. The original purpose to hide Bookmark implementation was to prevent users from using the bookmark content, however if users (OGM and/or Fabric) need to use the content anyway, I see fewer points to hide it.

@michael-simons
Copy link
Contributor

Thanks, Zhen. I'd only remove the static Bookmark merge(Iterable<String> bookmarks);

With the Strings is totally fine with me this way.

Removed merge methods as the func is a duplicate of `from`
Copy link
Contributor

@michael-simons michael-simons left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your work on that.

@zhenlineo zhenlineo merged commit 2545bab into neo4j:4.0 Nov 18, 2019
@zhenlineo zhenlineo deleted the 4.0-bookmarks branch November 18, 2019 13:53
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.

3 participants