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 inserting only for DatastoreOperations #1729

Merged
merged 6 commits into from
Apr 21, 2023
Merged

Conversation

cfranzen
Copy link
Contributor

Implemented insert() and insertAll() on DatastoreOperations interface and correspondingly on DatastoreTemplate.

Closes #1024

@cfranzen cfranzen changed the title Add support for inserting only for DatastoreOperations feat: Add support for inserting only for DatastoreOperations Apr 17, 2023
@conventional-commit-lint-gcf
Copy link

🤖 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 automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

Copy link
Member

@meltsufin meltsufin left a 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?

@cfranzen
Copy link
Contributor Author

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.

Copy link
Member

@meltsufin meltsufin left a 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!

@cfranzen
Copy link
Contributor Author

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!

Good catch! Did not see the unused method. Test is using an enum instead of strings now.

@meltsufin meltsufin enabled auto-merge (squash) April 21, 2023 20:22
@meltsufin meltsufin added datastore type: enhancement New feature or request labels Apr 21, 2023
@sonarcloud
Copy link

sonarcloud bot commented Apr 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

85.0% 85.0% Coverage
0.0% 0.0% Duplication

@meltsufin meltsufin merged commit a478264 into GoogleCloudPlatform:main Apr 21, 2023
@cfranzen
Copy link
Contributor Author

@meltsufin Thanks for merging to main. Would it be possible to also merge my changes to the 3.x branch?

@meltsufin
Copy link
Member

@meltsufin Thanks for merging to main. Would it be possible to also merge my changes to the 3.x branch?

Sure, I opened #1766.

meltsufin added a commit that referenced this pull request Apr 24, 2023
) (#1766)

Co-authored-by: Christian Franzen <13965040+cfranzen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for inserting only for DatastoreOperations
2 participants