Documentation ¶
Index ¶
- Constants
- Variables
- func MethodRouteVersionToPattern(method, route, version string) string
- func ParseToParamKey(str string) (string, map[string][]int)
- func PatternToMethodRouteVersion(pattern string) (string, string, string)
- func ToEndpoint(str string) string
- type Node
- type Router
- func (r *Router) Add(method, route, version string, handler ctx.Handler) *Router
- func (r *Router) AddInjectableHandler(method, route, version string, handler any) *Router
- func (r *Router) For(methodInclusions []string, route string, version string) func(handlers ...ctx.Handler) *Router
- func (r *Router) Group(prefix string, subRouters ...*Router) *Router
- func (r *Router) Match(method, route, version string) (bool, string, map[string][]int, []string, []ctx.Handler)
- func (r *Router) Use(handlers ...ctx.Handler) *Router
- type RouterItem
- type ScanFn
- type Trie
Constants ¶
View Source
const ( ADD = iota + 1 USE FOR GROUP )
View Source
const SERVE = "SERVE" // Serving static files directive
Variables ¶
View Source
var HTTPMethods = []string{ http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete, http.MethodConnect, http.MethodOptions, http.MethodTrace, SERVE, }
View Source
var OperationsMapHTTPMethods = map[string]string{ http.MethodGet: http.MethodGet, http.MethodHead: http.MethodHead, http.MethodPost: http.MethodPost, http.MethodPut: http.MethodPut, http.MethodPatch: http.MethodPatch, http.MethodDelete: http.MethodDelete, http.MethodConnect: http.MethodConnect, http.MethodOptions: http.MethodOptions, http.MethodTrace: http.MethodTrace, SERVE: http.MethodGet, }
Functions ¶
func ToEndpoint ¶
Types ¶
type Router ¶
type Router struct { *Trie Hash map[string]RouterItem List []string GlobalMiddlewares []ctx.Handler InjectableHandlers map[string]any }
func (*Router) AddInjectableHandler ¶
type RouterItem ¶
Click to show internal directories.
Click to hide internal directories.