Documentation
¶
Index ¶
- type BunRouterAdapter
- type BunRouterConfig
- type BunRouterRegistration
- type BunRouterRequest
- func (b *BunRouterRequest) AllHeaders() map[string]string
- func (b *BunRouterRequest) Body() ([]byte, error)
- func (b *BunRouterRequest) Header(key string) string
- func (b *BunRouterRequest) Method() string
- func (b *BunRouterRequest) PathParam(key string) string
- func (b *BunRouterRequest) QueryParam(key string) string
- func (b *BunRouterRequest) URL() string
- type HTTPRequest
- func (h *HTTPRequest) AllHeaders() map[string]string
- func (h *HTTPRequest) Body() ([]byte, error)
- func (h *HTTPRequest) Header(key string) string
- func (h *HTTPRequest) Method() string
- func (h *HTTPRequest) PathParam(key string) string
- func (h *HTTPRequest) QueryParam(key string) string
- func (h *HTTPRequest) URL() string
- type HTTPResponseWriter
- type MuxAdapter
- type MuxParamExtractor
- type MuxRouteRegistration
- type PathParamExtractor
- type RouterConfig
- type StandardBunRouterAdapter
- type StandardMuxAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BunRouterAdapter ¶
type BunRouterAdapter struct {
// contains filtered or unexported fields
}
BunRouterAdapter adapts uptrace/bunrouter to work with our Router interface
func NewBunRouterAdapter ¶
func NewBunRouterAdapter(router *bunrouter.Router) *BunRouterAdapter
NewBunRouterAdapter creates a new bunrouter adapter
func NewBunRouterAdapterDefault ¶
func NewBunRouterAdapterDefault() *BunRouterAdapter
NewBunRouterAdapterDefault creates a new bunrouter adapter with default router
func (*BunRouterAdapter) GetBunRouter ¶
func (b *BunRouterAdapter) GetBunRouter() *bunrouter.Router
GetBunRouter returns the underlying bunrouter for direct access
func (*BunRouterAdapter) HandleFunc ¶
func (b *BunRouterAdapter) HandleFunc(pattern string, handler common.HTTPHandlerFunc) common.RouteRegistration
func (*BunRouterAdapter) ServeHTTP ¶
func (b *BunRouterAdapter) ServeHTTP(w common.ResponseWriter, r common.Request)
type BunRouterConfig ¶
type BunRouterConfig struct {
UseStrictSlash bool
RedirectTrailingSlash bool
HandleMethodNotAllowed bool
HandleOPTIONS bool
GlobalOPTIONS http.Handler
GlobalMethodNotAllowed http.Handler
PanicHandler func(http.ResponseWriter, *http.Request, interface{})
}
BunRouterConfig holds bunrouter-specific configuration
func DefaultBunRouterConfig ¶
func DefaultBunRouterConfig() *BunRouterConfig
DefaultBunRouterConfig returns default bunrouter configuration
type BunRouterRegistration ¶
type BunRouterRegistration struct {
// contains filtered or unexported fields
}
BunRouterRegistration implements RouteRegistration for bunrouter
func (*BunRouterRegistration) Methods ¶
func (b *BunRouterRegistration) Methods(methods ...string) common.RouteRegistration
func (*BunRouterRegistration) PathPrefix ¶
func (b *BunRouterRegistration) PathPrefix(prefix string) common.RouteRegistration
type BunRouterRequest ¶
type BunRouterRequest struct {
// contains filtered or unexported fields
}
BunRouterRequest adapts bunrouter.Request to our Request interface
func NewBunRouterRequest ¶
func NewBunRouterRequest(req bunrouter.Request) *BunRouterRequest
NewBunRouterRequest creates a new BunRouterRequest adapter
func (*BunRouterRequest) AllHeaders ¶
func (b *BunRouterRequest) AllHeaders() map[string]string
func (*BunRouterRequest) Body ¶
func (b *BunRouterRequest) Body() ([]byte, error)
func (*BunRouterRequest) Header ¶
func (b *BunRouterRequest) Header(key string) string
func (*BunRouterRequest) Method ¶
func (b *BunRouterRequest) Method() string
func (*BunRouterRequest) PathParam ¶
func (b *BunRouterRequest) PathParam(key string) string
func (*BunRouterRequest) QueryParam ¶
func (b *BunRouterRequest) QueryParam(key string) string
func (*BunRouterRequest) URL ¶
func (b *BunRouterRequest) URL() string
type HTTPRequest ¶
type HTTPRequest struct {
// contains filtered or unexported fields
}
HTTPRequest adapts standard http.Request to our Request interface
func NewHTTPRequest ¶
func NewHTTPRequest(r *http.Request) *HTTPRequest
func (*HTTPRequest) AllHeaders ¶
func (h *HTTPRequest) AllHeaders() map[string]string
func (*HTTPRequest) Body ¶
func (h *HTTPRequest) Body() ([]byte, error)
func (*HTTPRequest) Header ¶
func (h *HTTPRequest) Header(key string) string
func (*HTTPRequest) Method ¶
func (h *HTTPRequest) Method() string
func (*HTTPRequest) PathParam ¶
func (h *HTTPRequest) PathParam(key string) string
func (*HTTPRequest) QueryParam ¶
func (h *HTTPRequest) QueryParam(key string) string
func (*HTTPRequest) URL ¶
func (h *HTTPRequest) URL() string
type HTTPResponseWriter ¶
type HTTPResponseWriter struct {
// contains filtered or unexported fields
}
HTTPResponseWriter adapts our ResponseWriter interface to standard http.ResponseWriter
func NewHTTPResponseWriter ¶
func NewHTTPResponseWriter(w http.ResponseWriter) *HTTPResponseWriter
func (*HTTPResponseWriter) SetHeader ¶
func (h *HTTPResponseWriter) SetHeader(key, value string)
func (*HTTPResponseWriter) WriteHeader ¶
func (h *HTTPResponseWriter) WriteHeader(statusCode int)
func (*HTTPResponseWriter) WriteJSON ¶
func (h *HTTPResponseWriter) WriteJSON(data interface{}) error
type MuxAdapter ¶
type MuxAdapter struct {
// contains filtered or unexported fields
}
MuxAdapter adapts Gorilla Mux to work with our Router interface
func NewMuxAdapter ¶
func NewMuxAdapter(router *mux.Router) *MuxAdapter
NewMuxAdapter creates a new Mux adapter
func (*MuxAdapter) HandleFunc ¶
func (m *MuxAdapter) HandleFunc(pattern string, handler common.HTTPHandlerFunc) common.RouteRegistration
func (*MuxAdapter) ServeHTTP ¶
func (m *MuxAdapter) ServeHTTP(w common.ResponseWriter, r common.Request)
type MuxParamExtractor ¶
type MuxParamExtractor struct{}
MuxParamExtractor extracts parameters from Gorilla Mux
func (MuxParamExtractor) ExtractParams ¶
func (m MuxParamExtractor) ExtractParams(r *http.Request) map[string]string
type MuxRouteRegistration ¶
type MuxRouteRegistration struct {
// contains filtered or unexported fields
}
MuxRouteRegistration implements RouteRegistration for Mux
func (*MuxRouteRegistration) Methods ¶
func (m *MuxRouteRegistration) Methods(methods ...string) common.RouteRegistration
func (*MuxRouteRegistration) PathPrefix ¶
func (m *MuxRouteRegistration) PathPrefix(prefix string) common.RouteRegistration
type PathParamExtractor ¶
PathParamExtractor extracts path parameters from different router types
type RouterConfig ¶
type RouterConfig struct {
PathPrefix string
Middleware []func(http.Handler) http.Handler
ParamExtractor PathParamExtractor
}
RouterConfig holds router configuration
func DefaultRouterConfig ¶
func DefaultRouterConfig() *RouterConfig
DefaultRouterConfig returns default router configuration
type StandardBunRouterAdapter ¶
type StandardBunRouterAdapter struct {
*BunRouterAdapter
}
StandardBunRouterAdapter creates routes compatible with standard bunrouter handlers
func NewStandardBunRouterAdapter ¶
func NewStandardBunRouterAdapter() *StandardBunRouterAdapter
func (*StandardBunRouterAdapter) RegisterRoute ¶
func (s *StandardBunRouterAdapter) RegisterRoute(method, pattern string, handler func(http.ResponseWriter, *http.Request, map[string]string))
RegisterRoute registers a route that works with the existing Handler
func (*StandardBunRouterAdapter) RegisterRouteWithParams ¶
func (s *StandardBunRouterAdapter) RegisterRouteWithParams(method, pattern string, paramNames []string, handler func(http.ResponseWriter, *http.Request, map[string]string))
RegisterRouteWithParams registers a route with explicit parameter extraction
type StandardMuxAdapter ¶
type StandardMuxAdapter struct {
*MuxAdapter
}
StandardMuxAdapter creates routes compatible with standard http.HandlerFunc
func NewStandardMuxAdapter ¶
func NewStandardMuxAdapter() *StandardMuxAdapter
func (*StandardMuxAdapter) GetMuxRouter ¶
func (s *StandardMuxAdapter) GetMuxRouter() *mux.Router
GetMuxRouter returns the underlying mux router for direct access
func (*StandardMuxAdapter) RegisterRoute ¶
func (s *StandardMuxAdapter) RegisterRoute(pattern string, handler func(http.ResponseWriter, *http.Request, map[string]string)) *mux.Route
RegisterRoute registers a route that works with the existing Handler