-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathcontext.go
21 lines (18 loc) · 867 Bytes
/
context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package flag
type Context struct {
// EvaluationContextEnrichment will be merged with the evaluation context sent during the evaluation.
// It is useful to add common attributes to all the evaluation, such as a server version, environment, ...
//
// All those fields will be included in the custom attributes of the evaluation context,
// if in the evaluation context you have a field with the same name, it will override the common one.
// Default: nil
EvaluationContextEnrichment map[string]interface{}
// DefaultSdkValue is the default value of the SDK when calling the variation.
DefaultSdkValue interface{}
}
func (s *Context) AddIntoEvaluationContextEnrichment(key string, value interface{}) {
if s.EvaluationContextEnrichment == nil {
s.EvaluationContextEnrichment = make(map[string]interface{})
}
s.EvaluationContextEnrichment[key] = value
}