Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request updates the ORM context handling by replacing direct modifications of the Gorm instance with proper usage of the WithContext method and optimizes DB pool configuration. Key changes include:
- Removing the QueryWithSetContext mocks and introducing QueryWithContext mocks.
- Updating the Orm and Query functions to use WithContext for better concurrency safety.
- Refactoring Gorm initialization by moving logic to BuildGorm and removing the old Gorm file.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mocks/database/orm/QueryWithSetContext.go | Removed obsolete mock implementation for setting context |
| mocks/database/orm/QueryWithContext.go | Added new mock implementation for WithContext |
| database/orm/orm.go | Updated Query and WithContext functions for proper context handling |
| database/gorm/query.go | Refactored context handling in Query and improved Gorm pool configuration |
| database/gorm/gorm.go | Removed outdated Gorm initialization code |
| contracts/database/orm/orm.go | Updated interface from QueryWithSetContext to QueryWithContext |
Comments suppressed due to low confidence (1)
database/orm/orm.go:121
- Comparing r.ctx with context.Background() directly might lead to unintended behavior. Consider using a nil check or a different mechanism to verify if the context has been explicitly set.
if r.ctx != context.Background() {
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.15.x #979 +/- ##
==========================================
Coverage ? 68.63%
==========================================
Files ? 218
Lines ? 18944
Branches ? 0
==========================================
Hits ? 13003
Misses ? 5278
Partials ? 663 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 Description
✅ Checks