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

feat: add support for batch update documents #8

Merged
merged 7 commits into from
Jul 5, 2021
Merged

feat: add support for batch update documents #8

merged 7 commits into from
Jul 5, 2021

Conversation

olamothe
Copy link
Member

@olamothe olamothe commented Jul 1, 2021


import java.util.List;

public record BatchUpdate(List<DocumentBuilder> addOrUpdate, List<DocumentBuilder> delete) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL about Records. (https://www.baeldung.com/java-record-keyword). It's quite a neat feature.

Do you think there's place in the code where we should have used it? (ngl, I don't think that'd be worth the hassle but just knowing is good :) )

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes !

The only problem is that it does not entirely play well with the GSON library we use to encode/decode to JSON.

So I can't apply it everywhere blindly.

Encoding record with GSON should (or seems to) work, decoding records would explode, however.

For example. the FileContainer class in this PR could not use record because we need to decode the platform response with it.

But, as I'll be moving to write some tests this week, I'll refactor in some places to use record instead of standard classes.

@olamothe olamothe merged commit bb98f67 into main Jul 5, 2021
@y-lakhdar y-lakhdar deleted the CDX-432 branch June 15, 2023 18:21
This was referenced Apr 30, 2024
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.

None yet

2 participants