-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [#358] Add Count, Pluck, DoesntExist, Distinct, FirstOr, Decrement, Increment, InsertGetId, When methods #931
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #931 +/- ##
=======================================
Coverage 68.82% 68.82%
=======================================
Files 154 154
Lines 10200 10200
=======================================
Hits 7020 7020
Misses 2857 2857
Partials 323 323 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50
.
Benchmark suite | Current: 50f17a6 | Previous: c3e937f | Ratio |
---|---|---|---|
BenchmarkFile_ReadWrite |
296340 ns/op 2072 B/op 28 allocs/op |
188515 ns/op 2072 B/op 28 allocs/op |
1.57 |
BenchmarkFile_ReadWrite - ns/op |
296340 ns/op |
188515 ns/op |
1.57 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this 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 introduces new query methods—including Count, Pluck, DoesntExist, FirstOr, Decrement, Increment, InsertGetId, When, and Latest—to enhance the database query builder functionality and adds corresponding tests for these methods.
- New query methods in database/db/query.go with updated condition field naming.
- Updated test files (database/db/query_test.go and tests/db_test.go) to cover the added methods.
- Adjustments to the mock builder and interface contracts to support the new functionality.
Reviewed Changes
File | Description |
---|---|
database/db/query_test.go | Added tests for Count, Decrement, Distinct, FirstOr, Increment, InsertGetId, Latest, When, and Pluck. |
tests/db_test.go | Extended tests for query methods including Count, Decrement, Distinct, Increment, InsertGetId, and Pluck. |
mocks/database/db/Builder.go | Added Query method mocks to support new builder functionality. |
database/db/query.go | Introduced new query methods and updated condition field references to uppercase. |
contracts/database/db/db.go | Updated the Query interface with new methods and detailed comments. |
database/db/conditions.go | Updated Conditions struct field names from lowercase to uppercase. |
database/db/utils.go | Modified error returns in the conversion functions to use a standardized error message. |
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
database/db/query.go:68
- [nitpick] In the Count() method, the trace() call uses -1 for rowsAffected even on success; consider using a more representative value (e.g., the actual count) or a consistent placeholder to improve logging clarity.
r.trace(sql, args, -1, nil)
📑 Description
goravel/goravel#358
@coderabbitai summary
✅ Checks