Documentation
¶
Index ¶
- type ErrorHandler
- type ForwardedHeadersPolicy
- type Handler
- type Kernel
- type MatchResult
- type Middleware
- type RateLimiter
- type Request
- type RequestContext
- type Response
- type RouteDefinition
- type RouteGroup
- type RouteHandler
- type RouteOptions
- type RouteRegistry
- type Router
- type RuntimeRateLimiter
- type SessionCookiePolicy
- type UrlGenerationRouteDefinition
- type UrlGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandler ¶
type ErrorHandler func( runtime runtimecontract.Runtime, writer nethttp.ResponseWriter, request Request, err error, ) Response
type ForwardedHeadersPolicy ¶
type Handler ¶
type Handler func( runtimeInstance runtimecontract.Runtime, writer nethttp.ResponseWriter, request Request, ) (Response, error)
type Kernel ¶
type Kernel interface {
Use(middlewares ...Middleware)
SetNotFoundHandler(handler Handler)
SetErrorHandler(handler ErrorHandler)
SetForwardedHeadersPolicy(policy ForwardedHeadersPolicy)
SetSessionCookiePolicy(policy SessionCookiePolicy)
ServeHttp(serviceContainer containercontract.Container) nethttp.Handler
}
type MatchResult ¶
type Middleware ¶
type RateLimiter ¶
type Request ¶
type Request interface {
HttpRequest() *nethttp.Request
Param(name string) (string, bool)
Params() map[string]string
Query() bagcontract.ParameterBag
Post() bagcontract.ParameterBag
Attributes() bagcontract.ParameterBag
Header(name string) string
RouteName() string
RoutePattern() string
RuntimeInstance() runtimecontract.Runtime
RequestContext() RequestContext
}
type RequestContext ¶
type RouteDefinition ¶
type RouteGroup ¶ added in v1.1.0
type RouteHandler ¶ added in v1.1.0
type RouteHandler interface {
Handle(method string, pattern string, handler Handler)
HandleNamed(name string, method string, pattern string, handler Handler)
HandleController(method string, pattern string, controller any)
HandleNamedController(name string, method string, pattern string, controller any)
HandleWithOptions(pattern string, handler Handler, options RouteOptions)
}
type RouteOptions ¶ added in v1.1.0
type RouteOptions interface {
Name() string
SetName(name string)
Methods() []string
Host() string
Schemes() []string
Requirements() map[string]string
SetRequirements(requirements map[string]string)
Defaults() map[string]string
SetDefaults(defaults map[string]string)
Locales() []string
Priority() int
Attributes() map[string]any
}
type RouteRegistry ¶
type RouteRegistry interface {
RouteDefinitions() []RouteDefinition
RouteDefinition(routeName string) (RouteDefinition, bool)
RouteDefinitionForUrlGeneration(routeName string) (UrlGenerationRouteDefinition, bool)
}
type Router ¶
type Router interface {
RouteHandler
RouteDefinitions() []RouteDefinition
RouteDefinition(routeName string) (RouteDefinition, bool)
Match(method string, path string, host string, scheme string) (*MatchResult, bool)
Group(pathPrefix string) RouteGroup
}
type RuntimeRateLimiter ¶ added in v1.16.0
type RuntimeRateLimiter interface {
RateLimiter
AllowWithRuntime(runtimeInstance runtimecontract.Runtime, key string) (bool, error)
}
RuntimeRateLimiter is an optional widening of RateLimiter for shared-store limiters: AllowWithRuntime threads the request context to the store and reports store failures. The returned allowed value must already reflect the limiter's failure policy, so callers honor it even when an error is returned; the rate-limit middleware prefers this method when the configured limiter implements it.
type SessionCookiePolicy ¶
Click to show internal directories.
Click to hide internal directories.