-
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: [#614] Optimize facades.Orm().Query().Exists(), Order() and Count() methods #929
Conversation
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 optimizes the Query.Exists() method by changing its signature to return a (bool, error) pair rather than taking a pointer argument. Key changes include updating the mocks to align with the new signature, modifying the actual Query.Exists implementation in the database package, and updating tests and contracts to reflect the new behavior.
Reviewed Changes
File | Description |
---|---|
mocks/database/orm/Query.go | Updated mock function for Exists to match the new (bool, error) API. |
database/gorm/query.go | Adjusted the Exists implementation to return a bool and error. |
tests/query_test.go | Modified tests to work with the revised Exists signature. |
contracts/database/orm/orm.go | Updated the interface for Exists to match the new signature. |
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
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: 76e4256 | Previous: 84fded1 | Ratio |
---|---|---|---|
BenchmarkFile_ReadWrite |
298600 ns/op 2072 B/op 28 allocs/op |
184761 ns/op 2072 B/op 28 allocs/op |
1.62 |
BenchmarkFile_ReadWrite - ns/op |
298600 ns/op |
184761 ns/op |
1.62 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## master #929 +/- ##
=======================================
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. |
@@ -107,11 +107,14 @@ type Query interface { | |||
// Omit specifies columns that should be omitted from the query. | |||
Omit(columns ...string) Query | |||
// Order specifies the order in which the results should be returned. | |||
// DEPRECATED Use OrderByRaw instead. |
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.
Consistent with Laravel
π Description
Closes goravel/goravel#614
@coderabbitai summary
β Checks