feat: Some nit optimizations for facades.DB#963
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new Statement method to both the database layer and its mocks for executing raw SQL, while removing the Exec method from the mocks and the main code. Key changes include:
- Removal of the Exec method from mocks and the transaction interface.
- Addition of the Statement method and its corresponding mock helpers in both DB.go and Tx.go.
- Updating tests and interface definitions to reflect the new Statement functionality.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mocks/database/db/DB.go | Removed Exec mocks and added a new Statement mock function. |
| mocks/database/db/Tx.go | Removed Exec mocks and added a new Statement mock function. |
| tests/db_test.go | Updated test function to include new Statement call; renamed tests accordingly. |
| database/db/db.go | Removed Exec and added a Statement method that wraps exec. |
| contracts/database/db/db.go | Updated the Tx interface to replace Exec with Statement. |
Comments suppressed due to low confidence (1)
tests/db_test.go:208
- [nitpick] The test function name still includes 'Exec', which might be misleading since the Exec method has been removed; consider renaming the function to accurately reflect that it tests the new Statement functionality.
func (s *DBTestSuite) Test_DB_Select_Insert_Update_Delete_Exec() {
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #963 +/- ##
=======================================
Coverage 69.14% 69.14%
=======================================
Files 158 158
Lines 10607 10607
=======================================
Hits 7334 7334
Misses 2942 2942
Partials 331 331 ☔ 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
The summary will be generated by Copilot in the below.
✅ Checks