Reverse reverses route to URL string by replacing path parameters with given params values.
(routeName string, pathValues ...any)
| 115 | |
| 116 | // Reverse reverses route to URL string by replacing path parameters with given params values. |
| 117 | func (r Routes) Reverse(routeName string, pathValues ...any) (string, error) { |
| 118 | for _, rr := range r { |
| 119 | if rr.Name == routeName { |
| 120 | return rr.Reverse(pathValues...), nil |
| 121 | } |
| 122 | } |
| 123 | return "", errors.New("route not found") |
| 124 | } |
| 125 | |
| 126 | // FindByMethodPath searched for matching route info by method and path |
| 127 | func (r Routes) FindByMethodPath(method string, path string) (RouteInfo, error) { |
no outgoing calls