Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame contribute delete
502 Bytes
package apikey
import "context"
type contextKey int
const (
contextKeyPolicy contextKey = iota
)
// PolicyFromContext returns the Policy associated with the given context.
func PolicyFromContext(ctx context.Context) *GQLPolicy {
p, _ := ctx.Value(contextKeyPolicy).(*GQLPolicy)
return p
}
// ContextWithPolicy returns a new context with the given Policy attached.
func ContextWithPolicy(ctx context.Context, p *GQLPolicy) context.Context {
return context.WithValue(ctx, contextKeyPolicy, p)
}