Documentation
¶
Overview ¶
Package entities //
Package entities //
Package entities //
Package entities //
Package entities //
Package entities //
Package entities //
Package entities //
Index ¶
- type Attribute
- type Audience
- type Condition
- type Event
- type Experiment
- type Feature
- type Group
- type Range
- type Rollout
- type TreeNode
- type TreeParameters
- type UserContext
- func (u UserContext) CheckAttributeExists(attrName string) bool
- func (u UserContext) GetBoolAttribute(attrName string) (bool, error)
- func (u UserContext) GetBucketingID() (string, error)
- func (u UserContext) GetFloatAttribute(attrName string) (float64, error)
- func (u UserContext) GetIntAttribute(attrName string) (int64, error)
- func (u UserContext) GetStringAttribute(attrName string) (string, error)
- type Variable
- type VariableType
- type Variation
- type VariationVariable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
Name string `json:"name"`
Match string `json:"match"`
Type string `json:"type"`
Value interface{} `json:"value"`
}
Condition has condition info
type Event ¶
type Event struct {
ID string `json:"id"`
Key string `json:"key"`
ExperimentIds []string `json:"experimentIds"`
}
Event represents a conversion event
type Experiment ¶
type Experiment struct {
AudienceIds []string
ID string
LayerID string
Key string
Variations map[string]Variation // keyed by variation ID
VariationKeyToIDMap map[string]string
TrafficAllocation []Range
GroupID string
AudienceConditionTree *TreeNode
Whitelist map[string]string
IsFeatureExperiment bool
}
Experiment represents an experiment
type Feature ¶
type Feature struct {
ID string
Key string
FeatureExperiments []Experiment
Rollout Rollout
VariableMap map[string]Variable
}
Feature represents a feature flag
type Rollout ¶
type Rollout struct {
ID string
Experiments []Experiment
}
Rollout represents a feature rollout
type TreeNode ¶
type TreeNode struct {
Item interface{} // can be a condition or a string
Operator string
Nodes []*TreeNode
}
TreeNode in a condition tree
type TreeParameters ¶
type TreeParameters struct {
User *UserContext
AudienceMap map[string]Audience
}
TreeParameters represents parameters of a tree
func NewTreeParameters ¶
func NewTreeParameters(user *UserContext, audience map[string]Audience) *TreeParameters
NewTreeParameters returns TreeParameters object
type UserContext ¶
UserContext holds information about a user
func (UserContext) CheckAttributeExists ¶
func (u UserContext) CheckAttributeExists(attrName string) bool
CheckAttributeExists returns whether the specified attribute name exists in the attributes map.
func (UserContext) GetBoolAttribute ¶
func (u UserContext) GetBoolAttribute(attrName string) (bool, error)
GetBoolAttribute returns the bool value for the specified attribute name in the attributes map. Returns error if not found.
func (UserContext) GetBucketingID ¶
func (u UserContext) GetBucketingID() (string, error)
GetBucketingID returns the bucketing ID to use for the given user
func (UserContext) GetFloatAttribute ¶
func (u UserContext) GetFloatAttribute(attrName string) (float64, error)
GetFloatAttribute returns the float64 value for the specified attribute name in the attributes map. Returns error if not found.
func (UserContext) GetIntAttribute ¶
func (u UserContext) GetIntAttribute(attrName string) (int64, error)
GetIntAttribute returns the int64 value for the specified attribute name in the attributes map. Returns error if not found.
func (UserContext) GetStringAttribute ¶
func (u UserContext) GetStringAttribute(attrName string) (string, error)
GetStringAttribute returns the string value for the specified attribute name in the attributes map. Returns error if not found.
type Variable ¶
type Variable struct {
DefaultValue string
ID string
Key string
Type VariableType
}
Variable represents a feature variable
type VariableType ¶
type VariableType string
VariableType is the type of feature variable
const ( // String - the feature-variable type is string String VariableType = "string" // Integer - the feature-variable type is integer Integer VariableType = "integer" // Double - the feature-variable type is double Double VariableType = "double" // Boolean - the feature-variable type is boolean Boolean VariableType = "boolean" )
type Variation ¶
type Variation struct {
ID string
Variables map[string]VariationVariable
Key string
FeatureEnabled bool
}
Variation represents a variation in the experiment
type VariationVariable ¶
VariationVariable represents a Variable object from the Variation