Documentation ¶
Index ¶
- func P[T any](v T) *T
- type Handler
- type HandlerInformation
- type HandlerType
- type Information
- type Mux
- func (m *Mux) Find(rctx *chi.Context, method, path string) string
- func (m *Mux) Group(fn func(r Router)) Router
- func (m *Mux) Handle(pattern string, h Handler) Route
- func (m *Mux) HandleFunc(pattern string, h http.HandlerFunc) Route
- func (m *Mux) Info() *RouterInformation
- func (m *Mux) Match(rctx *chi.Context, method, path string) bool
- func (m *Mux) Method(method, pattern string, h Handler) Route
- func (m *Mux) MethodFunc(method, pattern string, h http.HandlerFunc) Route
- func (m *Mux) MethodNotAllowed(h http.HandlerFunc)
- func (m *Mux) Middlewares() chi.Middlewares
- func (m *Mux) Mount(pattern string, h http.Handler)
- func (m *Mux) NotFound(h http.HandlerFunc)
- func (m *Mux) Route(pattern string, fn func(r Router)) Router
- func (m *Mux) Routes() []chi.Route
- func (m *Mux) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (m *Mux) Use(middlewares ...func(http.Handler) http.Handler)
- func (m *Mux) With(middlewares ...func(http.Handler) http.Handler) Router
- func (m *Mux) WithInfo(fn func(info *RouterInformation)) Router
- type Route
- type RouteInformation
- func (c *RouteInformation) WithDescription(description string) *RouteInformation
- func (c *RouteInformation) WithHidden(hidden bool) *RouteInformation
- func (c *RouteInformation) WithInput(typ *HandlerType) *RouteInformation
- func (c *RouteInformation) WithOutput(typ *HandlerType) *RouteInformation
- func (c *RouteInformation) WithSummary(summary string) *RouteInformation
- type Router
- type RouterInformation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface { http.Handler Info() *HandlerInformation }
type HandlerInformation ¶
type HandlerInformation struct { Information Input *HandlerType Output *HandlerType Hidden bool }
type HandlerType ¶
func Binary ¶
func Binary(mimeTypes ...string) *HandlerType
func File ¶
func File() *HandlerType
func Json ¶
func Json[T any]() *HandlerType
type Information ¶
func (*Information) WithDescription ¶ added in v0.0.4
func (c *Information) WithDescription(description string) *Information
func (*Information) WithSummary ¶ added in v0.0.4
func (c *Information) WithSummary(summary string) *Information
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
func (*Mux) HandleFunc ¶
func (m *Mux) HandleFunc(pattern string, h http.HandlerFunc) Route
func (*Mux) Info ¶ added in v0.0.4
func (m *Mux) Info() *RouterInformation
func (*Mux) MethodFunc ¶
func (m *Mux) MethodFunc(method, pattern string, h http.HandlerFunc) Route
func (*Mux) MethodNotAllowed ¶
func (m *Mux) MethodNotAllowed(h http.HandlerFunc)
func (*Mux) Middlewares ¶
func (m *Mux) Middlewares() chi.Middlewares
func (*Mux) NotFound ¶
func (m *Mux) NotFound(h http.HandlerFunc)
func (*Mux) WithInfo ¶ added in v0.0.4
func (m *Mux) WithInfo(fn func(info *RouterInformation)) Router
type Route ¶
type Route interface { Handler WithInfo(fn func(route *RouteInformation)) Route }
type RouteInformation ¶ added in v0.0.4
type RouteInformation HandlerInformation
func (*RouteInformation) WithDescription ¶ added in v0.0.4
func (c *RouteInformation) WithDescription(description string) *RouteInformation
func (*RouteInformation) WithHidden ¶ added in v0.0.4
func (c *RouteInformation) WithHidden(hidden bool) *RouteInformation
func (*RouteInformation) WithInput ¶ added in v0.0.4
func (c *RouteInformation) WithInput(typ *HandlerType) *RouteInformation
func (*RouteInformation) WithOutput ¶ added in v0.0.4
func (c *RouteInformation) WithOutput(typ *HandlerType) *RouteInformation
func (*RouteInformation) WithSummary ¶ added in v0.0.4
func (c *RouteInformation) WithSummary(summary string) *RouteInformation
type Router ¶
type Router interface { http.Handler chi.Routes // Use appends one or more middlewares onto the Router stack. Use(middlewares ...func(http.Handler) http.Handler) // With adds inline middlewares for an endpoint handler. With(middlewares ...func(http.Handler) http.Handler) Router // Group adds a new inline-Router along the current routing // path, with a fresh middleware stack for the inline-Router. Group(fn func(r Router)) Router // Route mounts a sub-Router along a `pattern“ string. Route(pattern string, fn func(r Router)) Router // Mount attaches another http.Handler along ./pattern/* Mount(pattern string, h http.Handler) // Handle and HandleFunc adds routes for `pattern` that matches // all HTTP methods. Handle(pattern string, h Handler) Route HandleFunc(pattern string, h http.HandlerFunc) Route // Method and MethodFunc adds routes for `pattern` that matches // the `method` HTTP method. Method(method, pattern string, h Handler) Route MethodFunc(method, pattern string, h http.HandlerFunc) Route // NotFound defines a handler to respond whenever a route could // not be found. NotFound(h http.HandlerFunc) // MethodNotAllowed defines a handler to respond whenever a method is // not allowed. MethodNotAllowed(h http.HandlerFunc) // ++++ Information ++++ Info() *RouterInformation WithInfo(fn func(info *RouterInformation)) Router }
Router consisting of the gotrac routing methods used by chi's Mux, using only the standard net/http.
type RouterInformation ¶
type RouterInformation struct {
Information
}
func (*RouterInformation) WithDescription ¶ added in v0.0.4
func (c *RouterInformation) WithDescription(description string) *RouterInformation
func (*RouterInformation) WithSummary ¶ added in v0.0.4
func (c *RouterInformation) WithSummary(summary string) *RouterInformation
Click to show internal directories.
Click to hide internal directories.