diff --git a/routing.go b/routing.go index fb34bb1..198bd13 100755 --- a/routing.go +++ b/routing.go @@ -80,8 +80,8 @@ type RouteMiddleware interface { } type Router interface { - Call(r *http.Request, code string, params map[string]any, opts ...RouteFilterOption) (HttpResponse, error) - Get(uuid string, opts ...RouteFilterOption) (Route, bool) + Call(r *http.Request, code string, params map[string]any, opts ...RouteMatchOption) (HttpResponse, error) + Get(uuid string, opts ...RouteMatchOption) (Route, bool) Register(cr chi.Router) RefreshRoutes() error } @@ -108,22 +108,22 @@ type RouteParam interface { InjectRequestToGlobalParams(*http.Request, GlobalParams) error } -type RouteFilterOption func(opts *RouteFilterOptions) -type RouteFilterOptions struct { +type RouteMatchOption func(opts *RouteMatches) +type RouteMatches struct { categories []RouteCategory services []RouteService } -func (this RouteFilterOptions) RouteCategories() []RouteCategory { +func (this RouteMatches) RouteCategories() []RouteCategory { return this.categories } -func (this RouteFilterOptions) RouteServices() []RouteService { +func (this RouteMatches) RouteServices() []RouteService { return this.services } -func RouteFilter[T RouteCategory | RouteService](v T) RouteFilterOption { - return func(opt *RouteFilterOptions) { +func RouteMatch[T RouteCategory | RouteService](v T) RouteMatchOption { + return func(opt *RouteMatches) { switch value := any(v).(type) { case RouteCategory: opt.categories = append(opt.categories, value)