Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CtxInjector ¶
type CtxInjector struct {
// contains filtered or unexported fields
}
CtxInjector is a context injector that injects key-value pairs into a context. When list of injector is not defined, it does nothing.
func NewCtxInjector ¶
func NewCtxInjector(injectors ...KeyValueInjectorFunc) CtxInjector
NewCtxInjector creates a new context injector with the given injectors.
func (*CtxInjector) InjectKeyValues ¶
func (ci *CtxInjector) InjectKeyValues(ctx context.Context) context.Context
InjectKeyValues injects key-value pairs into a context and returns the new context. It iterates over the injectors and calls each one to get a key-value pair to inject.
func (*CtxInjector) Register ¶
func (ci *CtxInjector) Register(injector ...KeyValueInjectorFunc)
Register adds a new injector to the context injector.
type KeyValueInjectorFunc ¶
KeyValueInjectorFunc is type of a function that returns a key-value pair to be injected into a context.
Click to show internal directories.
Click to hide internal directories.