Documentation
¶
Index ¶
- Constants
- func GetNormalizedNumber(identifier string, bucketBy string) int
- func GetNormalizedNumberWithNormalizer(identifier string, bucketBy string, normalizer int) int
- func GetStructFieldValue(target interface{}, attr string) reflect.Value
- type Clause
- type Clauses
- type Distribution
- type Evaluation
- type FeatureConfig
- func (fc *FeatureConfig) BoolVariation(target *Target, defaultValue bool) bool
- func (fc FeatureConfig) Evaluate(target *Target) *Evaluation
- func (fc *FeatureConfig) GetKind() reflect.Kind
- func (fc FeatureConfig) GetSegmentIdentifiers() StrSlice
- func (fc FeatureConfig) GetVariationName(target *Target) string
- func (fc *FeatureConfig) IntVariation(target *Target, defaultValue int64) int64
- func (fc *FeatureConfig) JSONVariation(target *Target, defaultValue types.JSON) types.JSON
- func (fc *FeatureConfig) NumberVariation(target *Target, defaultValue float64) float64
- func (fc *FeatureConfig) StringVariation(target *Target, defaultValue string) string
- type FeatureState
- type Prerequisite
- type Segment
- type Segments
- type Serve
- type ServingRule
- type ServingRules
- type StrSlice
- type Tag
- type Target
- type Variation
- type VariationMap
- type Variations
- type WeightedVariation
Constants ¶
const (
// OneHundred MAX value for bucket
OneHundred = 100
)
Variables ¶
This section is empty.
Functions ¶
func GetNormalizedNumber ¶
GetNormalizedNumber returns normalized value with normalizer OneHundred
func GetNormalizedNumberWithNormalizer ¶
GetNormalizedNumberWithNormalizer returns a murmur hash value based on input arguments
func GetStructFieldValue ¶
GetStructFieldValue returns struct field value or simple value using attr field
Types ¶
type Distribution ¶
type Distribution struct {
BucketBy string
Variations []WeightedVariation
}
Distribution object used for Percentage Rollout evaluations
func (*Distribution) GetKeyName ¶
func (d *Distribution) GetKeyName(target *Target) string
GetKeyName returns variation identifier based on target
type Evaluation ¶
type Evaluation struct {
Flag string
Value interface{}
}
Evaluation object is in most cases returned value from evaluation methods and contains results of evaluated feature flag for target object
type FeatureConfig ¶
type FeatureConfig struct {
DefaultServe Serve
Environment string
Feature string
Kind string
OffVariation string
Prerequisites []Prerequisite
Project string
Rules ServingRules
State FeatureState
VariationToTargetMap []VariationMap
Variations Variations
Segments map[string]*Segment `json:"-"`
}
FeatureConfig object is actually where feature flag evaluation happens. It contains all data like rules, default values, variations and segments
func (*FeatureConfig) BoolVariation ¶
func (fc *FeatureConfig) BoolVariation(target *Target, defaultValue bool) bool
BoolVariation returns boolean evaluation for target
func (FeatureConfig) Evaluate ¶
func (fc FeatureConfig) Evaluate(target *Target) *Evaluation
Evaluate feature flag and return Evaluation object
func (*FeatureConfig) GetKind ¶
func (fc *FeatureConfig) GetKind() reflect.Kind
GetKind returns kind of feature flag
func (FeatureConfig) GetSegmentIdentifiers ¶
func (fc FeatureConfig) GetSegmentIdentifiers() StrSlice
GetSegmentIdentifiers returns all segments
func (FeatureConfig) GetVariationName ¶
func (fc FeatureConfig) GetVariationName(target *Target) string
GetVariationName returns variation identifier for target
func (*FeatureConfig) IntVariation ¶
func (fc *FeatureConfig) IntVariation(target *Target, defaultValue int64) int64
IntVariation returns int evaluation for target
func (*FeatureConfig) JSONVariation ¶
JSONVariation returns json evaluation for target
func (*FeatureConfig) NumberVariation ¶
func (fc *FeatureConfig) NumberVariation(target *Target, defaultValue float64) float64
NumberVariation returns number evaluation for target
func (*FeatureConfig) StringVariation ¶
func (fc *FeatureConfig) StringVariation(target *Target, defaultValue string) string
StringVariation returns string evaluation for target
type FeatureState ¶
type FeatureState string
FeatureState represents feature flag ON or OFF state
const ( // FeatureStateOff represents OFF state FeatureStateOff FeatureState = "off" // FeatureStateOn represents ON state FeatureStateOn FeatureState = "on" )
type Prerequisite ¶
Prerequisite object
type Segment ¶
type Segment struct {
// Unique identifier for the target segment.
Identifier string
// Name of the target segment.
Name string `json:"name"`
CreatedAt *int64
ModifiedAt *int64
Environment *string
Excluded StrSlice
Included StrSlice
// An array of rules that can cause a user to be included in this segment.
Rules Clauses
Tags []Tag
Version int64
}
Segment object used in feature flag evaluation. Examples: beta users, premium customers
type ServingRule ¶
ServingRule object
type ServingRules ¶
type ServingRules []ServingRule
ServingRules slice of ServingRule
func (ServingRules) GetVariationName ¶
func (sr ServingRules) GetVariationName(target *Target, segments Segments, defaultServe Serve) string
GetVariationName returns variation identifier or defaultServe
type StrSlice ¶
type StrSlice []string
StrSlice helper type used for string slice operations
func (StrSlice) ContainsSensitive ¶
ContainsSensitive checks if slice contains string
type Target ¶
type Target struct {
Identifier string
Name *string
Anonymous bool
Attributes map[string]interface{}
}
Target object
func (Target) GetAttrValue ¶
GetAttrValue returns value from target with specified attribute
type Variation ¶
Variation object
type VariationMap ¶
VariationMap object is variation which belongs to segments and targets
type Variations ¶
type Variations []Variation
Variations slice of variation
func (Variations) FindByIdentifier ¶
func (v Variations) FindByIdentifier(identifier string) *Variation
FindByIdentifier returns Variation with identifier if exist in variations
type WeightedVariation ¶
WeightedVariation represents Percentage Rollout data