Пример #1
0
// NewContextStartTime creates a new context that carries the provided start
// time.
func NewContextStartTime(ctx context.Context, start time.Time) context.Context {
	return context.WithValue(ctx, ctxKeyStartTime, start)
}
Пример #2
0
// NewContextRequestID creates a new context that carries the provided request
// ID value.
func NewContextRequestID(ctx context.Context, id string) context.Context {
	return context.WithValue(ctx, ctxKeyReqID, id)
}
Пример #3
0
// NewContextLogger creates a new context that carries the provided logger
// value.
func NewContextLogger(ctx context.Context, logger log.Logger) context.Context {
	return context.WithValue(ctx, ctxKeyLogger, logger)
}
Пример #4
0
// NewContextParams creates a new context that carries the provided params
// value.
func NewContextParams(ctx context.Context, params httprouter.Params) context.Context {
	return context.WithValue(ctx, ctxKeyParams, params)
}
Пример #5
0
// NewContextComponentName creates a new context that carries the provided
// componentName value.
func NewContextComponentName(ctx context.Context, componentName string) context.Context {
	return context.WithValue(ctx, ctxKeyComponent, componentName)
}