Skip to content

feat: [#358] Implement OrderBy#927

Merged
hwbrzzl merged 2 commits intomasterfrom
bowen/#358-8
Mar 2, 2025
Merged

feat: [#358] Implement OrderBy#927
hwbrzzl merged 2 commits intomasterfrom
bowen/#358-8

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Mar 2, 2025

📑 Description

goravel/goravel#358

@coderabbitai summary

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings March 2, 2025 02:15
@hwbrzzl hwbrzzl requested a review from a team as a code owner March 2, 2025 02:15
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 implements the OrderBy functionality to support sorting in queries as described in issue [#358].

  • Added three new methods (OrderBy, OrderByDesc, OrderByRaw) in the Query struct.
  • Updated buildSelect in query.go to include orderBy clauses.
  • Added a new orderBy field in the Conditions struct and updated the corresponding interface in contracts.

Reviewed Changes

File Description
database/db/query_test.go Added tests for OrderBy, OrderByDesc, and OrderByRaw usage.
database/db/query.go Implemented new OrderBy methods and modified buildSelect to apply ordering.
database/db/conditions.go Added orderBy field in Conditions to store ordering clauses.
contracts/database/db/db.go Updated Query interface with OrderBy methods.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

database/db/query.go:178

  • The clone() method performs a shallow copy of conditions, including the mutable orderBy slice. Consider deep copying conditions.orderBy to avoid unintended side effects when appending new order clauses.
query.conditions = r.conditions

@hwbrzzl hwbrzzl closed this Mar 2, 2025
@hwbrzzl hwbrzzl reopened this Mar 2, 2025
@codecov
Copy link

codecov bot commented Mar 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.82%. Comparing base (ec93c95) to head (bd415dc).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #927   +/-   ##
=======================================
  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.
📢 Have feedback on the report? Share it here.

@hwbrzzl hwbrzzl merged commit 84fded1 into master Mar 2, 2025
14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#358-8 branch March 2, 2025 02:21
almas-x pushed a commit that referenced this pull request Mar 12, 2025
* feat: [#358] Implement OrderBy

* chore: update mocks

---------

Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com>
almas-x pushed a commit that referenced this pull request Mar 18, 2025
* feat: [#358] Implement OrderBy

* chore: update mocks

---------

Co-authored-by: hwbrzzl <24771476+hwbrzzl@users.noreply.github.com>
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