Documentation
¶
Index ¶
- func Host(ctx context.Context) string
- func Middleware(ctx context.Context) []server.Middleware
- func Params(ctx context.Context) []string
- func Prefix(ctx context.Context) string
- func Time(ctx context.Context) time.Time
- func WithHost(ctx context.Context, host string) context.Context
- func WithHostPrefix(ctx context.Context, host, prefix string) context.Context
- func WithMiddleware(ctx context.Context, middleware ...server.Middleware) context.Context
- func WithPrefix(ctx context.Context, prefix string) context.Context
- func WithRoute(ctx context.Context, route *Route) context.Context
- func WithTime(ctx context.Context, t time.Time) context.Context
- type Config
- type Route
- type Router
- type RouterContextKey
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware returns a set of middleware from the context, or zero value if not defined
func WithHostPrefix ¶
WithHostPrefix returns a context with the given host and prefix
func WithMiddleware ¶
WithMiddleware returns a context with the given middleware
func WithPrefix ¶
WithPrefix returns a context with the given prefix
Types ¶
type Config ¶
type Config struct {
Services ServiceConfig `hcl:"services"`
}
func (Config) Description ¶
Description returns the description of the service
type Route ¶
type Route struct {
// Label
Label string `json:"label,omitempty"`
// Matched handler
Handler http.HandlerFunc `json:"-"`
// Matched host
Host string `json:"host,omitempty"`
// Matched prefix
Prefix string `json:"prefix,omitempty"`
// Matched path
Path string `json:"path,omitempty"`
// Computed parameters from the path
Parameters []string `json:"parameters,omitempty"`
// Whether the result was from the cache
Cached bool `json:"cached,omitempty"`
}
Route is a matched route handler, with associated host, prefix and path
type RouterContextKey ¶
type RouterContextKey int
type ServiceConfig ¶
type ServiceConfig map[string]struct { Service server.ServiceEndpoints `hcl:"service"` Middleware []server.Middleware `hcl:"middleware"` }
Click to show internal directories.
Click to hide internal directories.