feat: [#358] Implement GroupBy, Having, Join methods#935
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #935 +/- ##
=======================================
Coverage 69.16% 69.16%
=======================================
Files 157 157
Lines 10519 10519
=======================================
Hits 7275 7275
Misses 2911 2911
Partials 333 333 ☔ View full report in Codecov by Sentry. |
Contributor
There was a problem hiding this comment.
PR Overview
This PR implements additional query building methods—GroupBy, Having, and various JOIN clauses (CrossJoin, Join, LeftJoin, RightJoin)—to extend the ORM’s SQL query capabilities. Key changes include:
- New query methods in the database layer, updating the chaining API for GroupBy/Having and JOIN types.
- Corresponding mock implementations in both database and ORM mocks.
- Updated tests to verify the new query methods and integration with existing query semantics.
Reviewed Changes
| File | Description |
|---|---|
| database/db/query_test.go | Added tests for CrossJoin, GroupBy/Having, Join, LeftJoin, and RightJoin. |
| mocks/database/db/Query.go | Implemented mock functions for CrossJoin, GroupBy, Having, Join, LeftJoin, and RightJoin. |
| tests/db_test.go | Added integration tests exercising the new JOIN and GroupBy/Having methods. |
| mocks/database/orm/Query.go | Updated ORM mock functions to support the new GroupBy method and deprecate Group. |
| database/gorm/query.go | Deprecated the old Group method in favor of GroupBy and updated group building logic. |
| contracts/database/orm/orm.go | Updated the Query interface to deprecate Group and add GroupBy with corresponding documentation. |
| tests/query_test.go | Modified tests to use the new GroupBy and Having methods. |
| database/db/conditions.go | Extended the Conditions struct to include fields for CrossJoin, GroupBy, Having, and RightJoin. |
| contracts/database/db/db.go | Updated the Query interface to document and support the new JOIN and GroupBy/Having methods. |
| database/gorm/conditions.go | Updated the Conditions struct for the GORM implementation to align with new query methods. |
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
almas-x
pushed a commit
that referenced
this pull request
Mar 12, 2025
almas-x
pushed a commit
that referenced
this pull request
Mar 18, 2025
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
goravel/goravel#358
✅ Checks