feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods#949
feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods#949
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #949 +/- ##
==========================================
- Coverage 69.16% 69.15% -0.01%
==========================================
Files 157 157
Lines 10519 10526 +7
==========================================
+ Hits 7275 7279 +4
- Misses 2911 2913 +2
- Partials 333 334 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
PR Overview
This PR enhances the Query interface by introducing five new methods – Chunk, Each, FindOrFail, Sum, and UpdateOrInsert – and updating their mock implementations and tests. Key changes include new test cases for these methods in both package and integration tests, updated mocks to support the new functionalities, and refactored query logic with a helper function for find operations.
Reviewed Changes
| File | Description |
|---|---|
| database/db/query_test.go | Added tests for FindOrFail, Sum, and UpdateOrInsert methods. |
| tests/db_test.go | Added tests for Chunk, Sum, and UpdateOrInsert functionalities. |
| mocks/database/db/Query.go | Added mock methods for Chunk, Each, FindOrFail, Sum, and UpdateOrInsert. |
| database/db/query.go | Implemented new methods and a helper (findQuery) along with updated query logic. |
| contracts/database/db/db.go | Updated Query interface definitions to reflect the new method signatures. |
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
📑 Description
goravel/goravel#358
This pull request introduces several enhancements and new functionalities to the
Queryinterface and its associated methods in thedatabase/dbpackage. The changes include adding new methods, updating existing methods, and extending the mock functionality to support the new methods.Enhancements to
Queryinterface:contracts/database/db/db.go: Added theChunk,Each,FindOrFail,Sum, andUpdateOrInsertmethods to theQueryinterface. These methods provide additional querying capabilities and improve the flexibility of the interface. [1] [2] [3]Implementation of new methods:
database/db/query.go: Implemented theChunk,Each,FindOrFail,Sum, andUpdateOrInsertmethods. These methods enhance the querying functionality by supporting chunked processing, conditional updates, and more. [1] [2] [3] [4] [5]Refactoring and code simplification:
database/db/query.go: Refactored theFindmethod to use a helper functionfindQueryfor query construction. This change simplifies the code and improves readability. [1] [2]Mock functionality updates:
mocks/database/db/Query.go: Added mock implementations for the newChunk,Each,FindOrFail,Sum, andUpdateOrInsertmethods. These changes enable testing of the new functionalities using mocks. [1] [2] [3] [4] [5]✅ Checks