-
Notifications
You must be signed in to change notification settings - Fork 310
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 inserting only for DatastoreOperations #1729
Conversation
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. It looks good overall, but there is a lot of code duplication with the existing save()
method. Can you please improve that part?
...datastore/src/main/java/com/google/cloud/spring/data/datastore/core/DatastoreOperations.java
Show resolved
Hide resolved
...a-datastore/src/main/java/com/google/cloud/spring/data/datastore/core/DatastoreTemplate.java
Show resolved
Hide resolved
...astore/src/test/java/com/google/cloud/spring/data/datastore/core/DatastoreTemplateTests.java
Outdated
Show resolved
Hide resolved
Thanks for the review @meltsufin. I tried to apply all your suggestions to my change, especially reducing the code duplication. I am not completely happy with my solution for the tests: using parameterized tests and passing SAVE or INSERT as string. It works and duplicates nearly no code, but it is not that clean. Let me know when you have a better solution for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution. It looks good overall, but there is a lot of code duplication with the existing
save()
method. Can you please improve that part?Thanks for the review @meltsufin. I tried to apply all your suggestions to my change, especially reducing the code duplication. I am not completely happy with my solution for the tests: using parameterized tests and passing SAVE or INSERT as string. It works and duplicates nearly no code, but it is not that clean. Let me know when you have a better solution for that.
Thanks for making the deduplication changes. It looks much better. I can't really think of a better way to clean up the tests, other than using an enum instead of the strings for @ValueSource
. Let's do that and remove the unused method I pointed out, and this PR should be good to go!
...a-datastore/src/main/java/com/google/cloud/spring/data/datastore/core/DatastoreTemplate.java
Show resolved
Hide resolved
Good catch! Did not see the unused method. Test is using an enum instead of strings now. |
Kudos, SonarCloud Quality Gate passed! |
@meltsufin Thanks for merging to main. Would it be possible to also merge my changes to the 3.x branch? |
Sure, I opened #1766. |
) (#1766) Co-authored-by: Christian Franzen <13965040+cfranzen@users.noreply.github.com>
Implemented
insert()
andinsertAll()
on DatastoreOperations interface and correspondingly on DatastoreTemplate.Closes #1024