Skip to content

feat: [#632] Add GetRoutes method#1063

Merged
hwbrzzl merged 2 commits intomasterfrom
bowen/#632
Jun 6, 2025
Merged

feat: [#632] Add GetRoutes method#1063
hwbrzzl merged 2 commits intomasterfrom
bowen/#632

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Jun 6, 2025

📑 Description

Closes goravel/goravel#632

This pull request introduces a new method, GetRoutes, to the Route interface in contracts/route/route.go for retrieving all registered routes, along with its implementation in the mock Route object in mocks/route/Route.go. Additionally, it defines a new RouteInfo struct to encapsulate route metadata such as method, path, and handler.

Enhancements to route management:

  • Added GetRoutes method to Route interface: Enables retrieval of all registered routes in the router.
  • Introduced RouteInfo struct: Represents metadata for routes, including HTTP method, path, and handler name.

Mock implementation updates:

  • Implemented GetRoutes in mock Route: Provides a mock function for testing the GetRoutes method, including helper methods like Return and RunAndReturn for defining mock behavior.

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings June 6, 2025 14:43
@hwbrzzl hwbrzzl requested a review from a team as a code owner June 6, 2025 14:43
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.

Pull Request Overview

This pull request introduces a new GetRoutes method to the Route interface, which allows retrieving all registered routes, and provides a corresponding mock implementation along with a new RouteInfo struct to encapsulate route metadata.

  • Added GetRoutes method to the Route interface in contracts/route/route.go
  • Implemented a mock version of GetRoutes in mocks/route/Route.go
  • Introduced the RouteInfo struct to represent metadata (method, path, handler)

Reviewed Changes

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

File Description
mocks/route/Route.go Added a GetRoutes mock method with helper functions
contracts/route/route.go Updated Route interface and added RouteInfo struct

Copy link

@github-actions github-actions bot left a 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: 3219f8a Previous: e1d6732 Ratio
Benchmark_Fatal 2e-7 ns/op 0 B/op 0 allocs/op 1e-7 ns/op 0 B/op 0 allocs/op 2
Benchmark_Fatal - ns/op 2e-7 ns/op 1e-7 ns/op 2

This comment was automatically generated by workflow using github-action-benchmark.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.31%. Comparing base (e1d6732) to head (3219f8a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1063      +/-   ##
==========================================
+ Coverage   71.28%   71.31%   +0.03%     
==========================================
  Files         181      181              
  Lines       12732    12732              
==========================================
+ Hits         9076     9080       +4     
+ Misses       3266     3263       -3     
+ Partials      390      389       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl merged commit c739f65 into master Jun 6, 2025
13 of 14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/#632 branch June 6, 2025 15:18
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.

http路由需要返回所有注册的路由信息

2 participants