File size: 422 Bytes
d6f631f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package subscription

import "context"

type contextKey string

const (
	subscriptionoperation contextKey = "subscriptionoperation"
)

func NewSubscriptionOperationContext(ctx context.Context) context.Context {
	return context.WithValue(ctx, subscriptionoperation, true)
}

func IsSubscriptionOperation(ctx context.Context) bool {
	u, ok := ctx.Value(subscriptionoperation).(bool)
	if !ok {
		return false
	}

	return u
}