grafana/pkg/services/contexthandler/ctxkey/key.go
2023-08-30 18:46:47 +03:00

14 lines
221 B
Go

package ctxkey
import "context"
type Key struct{}
func Set(ctx context.Context, data any) context.Context {
return context.WithValue(ctx, Key{}, data)
}
func Get(ctx context.Context) any {
return ctx.Value(Key{})
}