Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attributes ¶
type Attributes map[string]interface{}
Attributes IMPORTANT: this map values type should be: string, int, float or bool. escapeAttributes function below satisfies this invariant
type Configuration ¶
type Configuration struct { HashKey string `json:"hashKey"` Flags []*FlagConfig `json:"flags"` SdkConfig SDKConfig `json:"sdkConfig,omitempty"` }
Configuration represent flagger configuration
func (*Configuration) Escape ¶
func (c *Configuration) Escape()
Escape represent method for escaping configuration
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core represent things for encapsulate business logic for flags calculation
func (*Core) EvaluateFlag ¶
func (core *Core) EvaluateFlag(codename string, entity *Entity) *FlagResult
EvaluateFlag represent method for calculation Flag for Entity by codename
func (*Core) SetConfig ¶
func (core *Core) SetConfig(v *Configuration)
SetConfig represent callback function for insert incoming configuration
type Entity ¶
type Entity struct { ID string `json:"id"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Variation string `json:"variation,omitempty"` // used only in whitelist Group *Group `json:"group,omitempty"` Attributes Attributes `json:"attributes,omitempty"` }
Entity represent flagger entity
func EscapeEntity ¶
EscapeEntity represent method for escaping Entity
type Event ¶
type Event struct { Name string `json:"name"` EventProperties Attributes `json:"eventProperties"` Entity *Entity `json:"entity,omitempty"` }
Event represent flagger event
func EscapeEvent ¶
EscapeEvent represent method for escaping event
type Exposure ¶
type Exposure struct { Codename string `json:"codename"` HashKey string `json:"hashkey,omitempty"` Variation string `json:"variation"` Entity *Entity `json:"entity"` MethodCalled string `json:"methodCalled"` Timestamp time.Time `json:"timestamp"` }
Exposure represent flagger exposure
type FilterValue ¶
type FilterValue interface{}
FilterValue IMPORTANT: this object must be on of: [ int | float | string | bool | []int, []float | []string | []bool ]
type FlagConfig ¶
type FlagConfig struct { Codename string `json:"codename"` KillSwitchEngaged bool `json:"killSwitchEngaged,omitempty"` HashKey string `json:"hashkey,omitempty"` Variations []*FlagVariation `json:"variations,omitempty"` FlagSubPopulations []*FlagSubpopulation `json:"subpopulations,omitempty"` Blacklist []*Entity `json:"blacklist,omitempty"` Whitelist []*Entity `json:"whitelist,omitempty"` }
FlagConfig represent flagger flag configuration
type FlagFilter ¶
type FlagFilter struct { AttributeName string `json:"attributeName"` Operator Operator `json:"operator"` Value FilterValue `json:"value"` FilterType string `json:"type"` }
FlagFilter represent one flag filter entity
type FlagResult ¶
type FlagResult struct { Hashkey string Entity *Entity Enabled bool Sampled bool Variation *FlagVariation Payload Payload IsNew bool Reason Reason }
FlagResult represent calculated flag result
type FlagSubpopulation ¶
type FlagSubpopulation struct { EntityType string `json:"entityType"` SamplingPercentage float64 `json:"samplingPercentage"` Filters []*FlagFilter `json:"filters"` }
FlagSubpopulation represent subpopulation entity of Flag
type FlagVariation ¶
type FlagVariation struct { Codename string `json:"codename"` Probability float64 `json:"probability"` Payload Payload `json:"payload"` }
FlagVariation represent variation entity of Flag
type Group ¶
type Group struct { ID string `json:"id"` Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Attributes Attributes `json:"attributes,omitempty"` }
Group represent flagger group from entities
type Reason ¶
type Reason string
Reason represent type of flag reason
const ( // NoEntityProvided represent flag reason for witch have no entity for calculating NoEntityProvided Reason = "No entity provided to Flagger" // ConfigIsEmpty FlaggerIsNotInitialized Reason = "Flagger is not initialized" // ConfigIsEmpty ConfigIsEmpty Reason = "No flags in the current config" // CodenameIsEmpty CodenameIsEmpty Reason = "Flag codename is empty" // IdIsEmpty IdIsEmpty Reason = "Id is empty" // FlagNotInConfig FlagNotInConfig Reason = "Flag is not in the current config" // KillSwitchEngaged KillSwitchEngaged Reason = "Kill switch engaged" // IndividualBlacklist IndividualBlacklist Reason = "Entity is individually blacklisted" // IndividualWhitelist IndividualWhitelist Reason = "Entity is individually whitelisted" // GroupBlacklist GroupBlacklist Reason = "Entity's group is blacklisted" // GroupWhitelist GroupWhitelist Reason = "Entity's group is whitelisted" // IsSampled IsSampled Reason = "Entity is sampled in the individual subpopulation" // IsSampledByGroup IsSampledByGroup Reason = "Entity is sampled in the group subpopulation" // Default Default Reason = "Default (off) treatment reached" )
type SDKConfig ¶
type SDKConfig struct { SDKIngestionInterval int `json:"SDK_INGESTION_INTERVAL,omitempty"` SDKIngestionMaxItems int `json:"SDK_INGESTION_MAX_CALLS,omitempty"` }
SDKConfig represent flagger SDK configuration