Documentation
¶
Index ¶
- func Join(elems ...string) string
- func Ok(c *Context, w http.ResponseWriter, req *http.Request) error
- type Context
- func (c *Context) Break()
- func (c *Context) Next(w http.ResponseWriter, req *http.Request) (err error)
- func (c *Context) RespondJSON(w http.ResponseWriter, v any) error
- func (c *Context) RespondJSONCode(w http.ResponseWriter, v any, code int) error
- func (c *Context) SetKV(k, v any)
- func (c *Context) UnmarshalRequestJSON(req *http.Request, v any) error
- type Handler
- type Middleware
- type Mux
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct {
Context context.Context
KV map[any]any
Timestamp time.Time
Mux *Mux
// contains filtered or unexported fields
}
func ContextFrom ¶
func (*Context) RespondJSON ¶
func (c *Context) RespondJSON(w http.ResponseWriter, v any) error
func (*Context) RespondJSONCode ¶
type Handler ¶
func RedirectCode ¶
func WrapStdHandler ¶
func WrapStdHandlerFunc ¶
func WrapStdHandlerFunc(f http.HandlerFunc) Handler
type Middleware ¶
type Middleware = Handler
func Alert ¶
func Alert(format string, args ...any) Middleware
func Deprecate ¶
func Deprecate(t time.Time) Middleware
func Link ¶
func Link(url, rel, typ string) Middleware
func Sunset ¶
func Sunset(t time.Time) Middleware
type Mux ¶
type Mux struct {
Router
ServeMux http.ServeMux
// Middlewares that run regardless of whether a handler was found or not.
Middlewares []Middleware
NotFound Handler
// OnHandle is called each time handler is registered. If set.
OnHandle func(pattern string, h Handler, ms []Middleware)
}
Click to show internal directories.
Click to hide internal directories.