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.
⚠️ 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.
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)
…ent, Increment, InsertGetId, When methods (#931) * feat: [#358] Add Value method * chore: update mocks * Add Limit method * update mock * fix sqlserver limit * chore: update mocks * remove unnecessary code * add Count method * chore: update mocks * add FirstOr method * add FirstOr method * add DoesntExist method * add InsertGetId method * add Latest method * add Latest method * add Distinct method * update mock * update mock * cancel test * optimize Pluck --------- Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com>
…ent, Increment, InsertGetId, When methods (#931) * feat: [#358] Add Value method * chore: update mocks * Add Limit method * update mock * fix sqlserver limit * chore: update mocks * remove unnecessary code * add Count method * chore: update mocks * add FirstOr method * add FirstOr method * add DoesntExist method * add InsertGetId method * add Latest method * add Latest method * add Distinct method * update mock * update mock * cancel test * optimize Pluck --------- Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com>
📑 Description
goravel/goravel#358
@coderabbitai summary
✅ Checks