Skip to content

feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods#949

Merged
hwbrzzl merged 4 commits intomasterfrom
bowen/#358-19
Mar 9, 2025
Merged

feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods#949
hwbrzzl merged 4 commits intomasterfrom
bowen/#358-19

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Mar 8, 2025

📑 Description

goravel/goravel#358

This pull request introduces several enhancements and new functionalities to the Query interface and its associated methods in the database/db package. The changes include adding new methods, updating existing methods, and extending the mock functionality to support the new methods.

Enhancements to Query interface:

  • contracts/database/db/db.go: Added the Chunk, Each, FindOrFail, Sum, and UpdateOrInsert methods to the Query interface. 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 the Chunk, Each, FindOrFail, Sum, and UpdateOrInsert methods. 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 the Find method to use a helper function findQuery for 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 new Chunk, Each, FindOrFail, Sum, and UpdateOrInsert methods. These changes enable testing of the new functionalities using mocks. [1] [2] [3] [4] [5]

✅ Checks

  • Added test cases for my code

@codecov
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.15%. Comparing base (4d97391) to head (fcb25a8).
Report is 2 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl marked this pull request as ready for review March 9, 2025 03:51
Copilot AI review requested due to automatic review settings March 9, 2025 03:51
@hwbrzzl hwbrzzl requested a review from a team as a code owner March 9, 2025 03:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@hwbrzzl hwbrzzl merged commit 52dee9c into master Mar 9, 2025
12 of 13 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#358-19 branch March 9, 2025 03:55
almas-x pushed a commit that referenced this pull request Mar 12, 2025
* feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods

* add tests

* add tests

* optimize test
almas-x pushed a commit that referenced this pull request Mar 18, 2025
* feat: [#358] Add Chunk Each FindOrFail Sum UpdateOrInsert methods

* add tests

* add tests

* optimize test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants