1package store
 2
 3import "context"
 4
 5// ContextKey is the store context key.
 6var ContextKey = &struct{ string }{"store"}
 7
 8// FromContext returns the store from the given context.
 9func FromContext(ctx context.Context) Store {
10	if s, ok := ctx.Value(ContextKey).(Store); ok {
11		return s
12	}
13
14	return nil
15}
16
17// WithContext returns a new context with the given store.
18func WithContext(ctx context.Context, s Store) context.Context {
19	return context.WithValue(ctx, ContextKey, s)
20}