Documentation
¶
Index ¶
- Constants
- func Cors() func(http.Handler) http.Handler
- func GZIP() func(http.Handler) http.Handler
- func Logging(dumpRequest bool) func(http.Handler) http.Handler
- func Recovery() func(http.Handler) http.Handler
- func Var(r *http.Request, key string) string
- func WriteJSON(w http.ResponseWriter, status int, v any)
- type Filter
- type FilterComparator
- type IgnoreTrailingSlashes
- type Meta
- func (m *Meta) ChangeFilterValueInt(name string, v int)
- func (m Meta) FilterValue(name string) interface{}
- func (m Meta) FilterValueBool(name string) bool
- func (m Meta) FilterValueFloat(name string) float64
- func (m Meta) FilterValueInt(name string) int
- func (m Meta) FilterValueString(name string) string
- func (m Meta) Query() string
- func (m Meta) SortOrder(name string) SortOrder
- type PrefixRouter
- func (r *PrefixRouter) DELETE(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) GET(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) HEAD(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) Handler(mwares ...mux.MiddlewareFunc) http.Handler
- func (r *PrefixRouter) POST(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) PUT(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) Prefix() string
- func (r *PrefixRouter) PrefixGET(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *PrefixRouter) Resolve(pattern string) string
- func (r *PrefixRouter) WithPrefix(prefix string) *PrefixRouter
- type Router
- func (r *Router) DELETE(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) GET(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) HEAD(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) Handler(mwares ...mux.MiddlewareFunc) http.Handler
- func (r *Router) POST(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PUT(pattern string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PrefixDELETE(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PrefixGET(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PrefixGETHandler(prefix string, handler http.Handler, options ...interface{})
- func (r *Router) PrefixHEAD(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PrefixPOST(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) PrefixPOSTHandler(prefix string, handler http.Handler, options ...interface{})
- func (r *Router) PrefixPUT(prefix string, handle http.HandlerFunc, options ...interface{})
- func (r *Router) WithPrefix(prefix string) *PrefixRouter
- type Server
- type SortComponent
- type SortComponents
- type SortConfiguration
- type SortField
- type SortOrder
- type StatusWriter
- type Timing
Constants ¶
const ( HeaderContentType = "Content-Type" HeaderAccept = "Accept" HeaderContentEncoding = "Content-Encoding" )
const (
ContentTypeJSONUTF8 = "application/json; charset=utf-8"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Filter ¶
type Filter struct { Name string Comparator FilterComparator Value string }
Filter defines a general filter
type FilterComparator ¶
type FilterComparator string
FilterComparator types a comparator
const ( FilterComparatorEqual FilterComparator = "eq" FilterComparatorLess FilterComparator = "ls" FilterComparatorGreater FilterComparator = "gt" FilterComparatorLike FilterComparator = "like" )
type IgnoreTrailingSlashes ¶
type IgnoreTrailingSlashes struct{}
type Meta ¶
type Meta struct { Limit int Skip int Filters []Filter Sorts SortComponents }
Meta holds various filter and query parameters passed with a http request
func (*Meta) ChangeFilterValueInt ¶
func (Meta) FilterValue ¶
func (Meta) FilterValueBool ¶
func (Meta) FilterValueFloat ¶
func (Meta) FilterValueInt ¶
func (Meta) FilterValueString ¶
type PrefixRouter ¶
type PrefixRouter struct {
// contains filtered or unexported fields
}
PrefixRouter is a router, which routes prefixed routes
func (*PrefixRouter) DELETE ¶
func (r *PrefixRouter) DELETE(pattern string, handle http.HandlerFunc, options ...interface{})
DELETE registers a DELETE handler
func (*PrefixRouter) GET ¶
func (r *PrefixRouter) GET(pattern string, handle http.HandlerFunc, options ...interface{})
GET registers a GET handler
func (*PrefixRouter) HEAD ¶
func (r *PrefixRouter) HEAD(pattern string, handle http.HandlerFunc, options ...interface{})
HEAD registers a HEAD handler
func (*PrefixRouter) Handler ¶
func (r *PrefixRouter) Handler(mwares ...mux.MiddlewareFunc) http.Handler
func (*PrefixRouter) POST ¶
func (r *PrefixRouter) POST(pattern string, handle http.HandlerFunc, options ...interface{})
POST registers a POST handler
func (*PrefixRouter) PUT ¶
func (r *PrefixRouter) PUT(pattern string, handle http.HandlerFunc, options ...interface{})
PUT registers a PUT handler
func (*PrefixRouter) Prefix ¶
func (r *PrefixRouter) Prefix() string
func (*PrefixRouter) PrefixGET ¶
func (r *PrefixRouter) PrefixGET(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixGET registers a GET handler, which matches all routes with the given prefix
func (*PrefixRouter) Resolve ¶
func (r *PrefixRouter) Resolve(pattern string) string
func (*PrefixRouter) WithPrefix ¶
func (r *PrefixRouter) WithPrefix(prefix string) *PrefixRouter
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router encapsulates a http router
func (*Router) DELETE ¶
func (r *Router) DELETE(pattern string, handle http.HandlerFunc, options ...interface{})
func (*Router) GET ¶
func (r *Router) GET(pattern string, handle http.HandlerFunc, options ...interface{})
GET registers a GET handler
func (*Router) HEAD ¶
func (r *Router) HEAD(pattern string, handle http.HandlerFunc, options ...interface{})
func (*Router) Handler ¶
func (r *Router) Handler(mwares ...mux.MiddlewareFunc) http.Handler
Handler returns the http handler of the router
func (*Router) POST ¶
func (r *Router) POST(pattern string, handle http.HandlerFunc, options ...interface{})
POST registers a POST handler
func (*Router) PUT ¶
func (r *Router) PUT(pattern string, handle http.HandlerFunc, options ...interface{})
func (*Router) PrefixDELETE ¶
func (r *Router) PrefixDELETE(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixDELETE registers a DELETE handler, which matches all routes with the given prefix
func (*Router) PrefixGET ¶
func (r *Router) PrefixGET(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixGET registers a GET handler, which matches all routes with the given prefix
func (*Router) PrefixGETHandler ¶
PrefixGETHandler registers a GET handler, which matches all routes with the given prefix
func (*Router) PrefixHEAD ¶
func (r *Router) PrefixHEAD(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixHEAD registers a HEAD handler, which matches all routes with the given prefix
func (*Router) PrefixPOST ¶
func (r *Router) PrefixPOST(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixPOST registers a POST handler, which matches all routes with the given prefix
func (*Router) PrefixPOSTHandler ¶
PrefixPOSTHandler registers a POST handler, which matches all routes with the given prefix
func (*Router) PrefixPUT ¶
func (r *Router) PrefixPUT(prefix string, handle http.HandlerFunc, options ...interface{})
PrefixPUT registers a PUT handler, which matches all routes with the given prefix
func (*Router) WithPrefix ¶
func (r *Router) WithPrefix(prefix string) *PrefixRouter
WithPrefix return a prefix-router for the given prefix
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type SortComponent ¶
func (SortComponent) String ¶
func (sc SortComponent) String() string
type SortComponents ¶
type SortComponents []SortComponent
func (SortComponents) String ¶
func (scs SortComponents) String() string
type SortConfiguration ¶
type SortConfiguration struct { Fields []SortField `json:"fields,omitempty"` Components SortComponents `json:"components,omitempty"` }
type StatusWriter ¶
type StatusWriter struct {
// contains filtered or unexported fields
}
func NewStatusWriter ¶
func NewStatusWriter(w http.ResponseWriter) *StatusWriter
func (*StatusWriter) Code ¶
func (sw *StatusWriter) Code() int
func (*StatusWriter) Header ¶
func (sw *StatusWriter) Header() http.Header
func (*StatusWriter) WriteHeader ¶
func (sw *StatusWriter) WriteHeader(code int)
type Timing ¶
type Timing struct {
// contains filtered or unexported fields
}
func (*Timing) StopCurrAgg ¶
func (t *Timing) StopCurrAgg()
func (*Timing) Write ¶
func (t *Timing) Write(w http.ResponseWriter)