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

fix: use RETURNING clause for batch create #3293

Merged
merged 9 commits into from May 30, 2023
Merged

Conversation

aeneasr
Copy link
Member

@aeneasr aeneasr commented May 26, 2023

batch.Create regressed on gobuffalo/pop improvements that use RETURNING clauses and gen_random_uuid(). This patch addresses that

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.

@aeneasr aeneasr requested review from hperl and alnr May 26, 2023 08:56
@aeneasr aeneasr requested a review from zepatrik as a code owner May 26, 2023 08:56
@aeneasr
Copy link
Member Author

aeneasr commented May 26, 2023

Added some comments, all tests pass now. Should be good to go!

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #3293 (3614fc9) into master (387f5a2) will decrease coverage by 0.07%.
The diff coverage is 65.71%.

❗ Current head 3614fc9 differs from pull request most recent head b9fb700. Consider uploading reports for the commit b9fb700 to get more accurate results

@@            Coverage Diff             @@
##           master    #3293      +/-   ##
==========================================
- Coverage   77.64%   77.57%   -0.07%     
==========================================
  Files         325      325              
  Lines       20511    20570      +59     
==========================================
+ Hits        15925    15958      +33     
- Misses       3367     3386      +19     
- Partials     1219     1226       +7     
Impacted Files Coverage Δ
persistence/sql/batch/create.go 76.37% <65.21%> (-14.67%) ⬇️
persistence/sql/identity/persister_identity.go 80.03% <100.00%> (-0.04%) ⬇️

... and 1 file with indirect coverage changes

Copy link
Contributor

@alnr alnr left a comment

Choose a reason for hiding this comment

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

Nice! Small nit

@@ -38,7 +42,7 @@ type (
}
)

func buildInsertQueryArgs[T any](ctx context.Context, quoter quoter, models []*T) insertQueryArgs {
func buildInsertQueryArgs[T any](ctx context.Context, dialect string, mapper *reflectx.Mapper, quoter quoter, models []*T) (insertQueryArgs, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

buildInsertQueryArgs never returns an error I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

true, probably an artifact form playing around with reflection. Will fix

Copy link
Member Author

@aeneasr aeneasr May 30, 2023

Choose a reason for hiding this comment

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

adressed

Copy link
Contributor

@hperl hperl left a comment

Choose a reason for hiding this comment

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

LGTM!

@aeneasr aeneasr merged commit 8ae8783 into master May 30, 2023
29 of 30 checks passed
@aeneasr aeneasr deleted the improve-persister-batch branch May 30, 2023 11:37
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

3 participants