Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEndpointMiddleware ¶
func NewEndpointMiddleware() endpoint.Middleware
NewEndpointMiddleware ensures that there is a ContextMap in the context of an endpoint.
Types ¶
type ContextMap ¶
type ContextMap interface { String() string WithCtx(context.Context) context.Context Set(key string, val interface{}) ContextMap Get(key string) interface{} }
ContextMap provides a way to enrich a context.Context with information on lower layers and have this information available on the upper layers.
func Ctx ¶
func Ctx(ctx context.Context) ContextMap
Ctx retrieved a ContextMap from the context.Context. If there isn't a ContextMap in the context, a noop ContextMap is returned, so it is safe to do something like Ctx(ctx).Set("key", "value").
func New ¶
func New() ContextMap
New returns a new ContextMap that can be embedded in a context.Context.
Click to show internal directories.
Click to hide internal directories.