Versions in this module Expand all Collapse all v0 v0.1.12 Aug 9, 2023 v0.1.11 Aug 9, 2023 Changes in this version + const ErrCondJSONNot + const ErrCondJSONSequence + const ErrCondJSONSequenceElement + const ErrCtxJSONInvalidURL + const ErrExpJSONInvalidCondition + const ErrJSONFailedToParse + const ErrJSONInvalidType + const InfoRuleSkipCondition + const InfoRuleSkipCoverage + const InfoRuleSkipEmptyHashAttribute + const InfoRuleSkipNoHashAttribute + const InfoRuleSkipUserNotInExp + const WarnCondCompareTypeMismatch + const WarnExpCoverageMustBeFraction + const WarnExpCoverageMustBePositive + const WarnExpJSONKeyNotSet + const WarnExpWeightsWrongLength + const WarnExpWeightsWrongTotal + const WarnJSONUnknownKey + const WarnRuleSkipHashAttributeType + func SetLogger(userLogger Logger) + type Attributes map[string]interface + type Condition interface + Eval func(attrs Attributes) bool + func BuildCondition(cond map[string]interface{}) Condition + func ParseCondition(data []byte) Condition + type Context struct + Attributes Attributes + Enabled bool + Features FeatureMap + ForcedVariations ForcedVariationsMap + QAMode bool + TrackingCallback ExperimentCallback + URL *url.URL + func BuildContext(dict map[string]interface{}) *Context + func NewContext() *Context + func ParseContext(data []byte) *Context + func (ctx *Context) WithAttributes(attributes Attributes) *Context + func (ctx *Context) WithEnabled(enabled bool) *Context + func (ctx *Context) WithFeatures(features FeatureMap) *Context + func (ctx *Context) WithForcedVariations(forcedVariations ForcedVariationsMap) *Context + func (ctx *Context) WithQAMode(qaMode bool) *Context + func (ctx *Context) WithTrackingCallback(trackingCallback ExperimentCallback) *Context + func (ctx *Context) WithURL(url *url.URL) *Context + type DevLogger struct + func (log *DevLogger) Error(msg string, args ...interface{}) + func (log *DevLogger) Errorf(format string, args ...interface{}) + func (log *DevLogger) Info(msg string, args ...interface{}) + func (log *DevLogger) Infof(format string, args ...interface{}) + func (log *DevLogger) Warn(msg string, args ...interface{}) + func (log *DevLogger) Warnf(format string, args ...interface{}) + type Experiment struct + Active bool + Condition Condition + Coverage *float64 + Force *int + HashAttribute *string + Key string + Namespace *Namespace + Variations []FeatureValue + Weights []float64 + func BuildExperiment(dict map[string]interface{}) *Experiment + func NewExperiment(key string) *Experiment + func ParseExperiment(data []byte) *Experiment + func (exp *Experiment) WithActive(active bool) *Experiment + func (exp *Experiment) WithCondition(condition Condition) *Experiment + func (exp *Experiment) WithCoverage(coverage float64) *Experiment + func (exp *Experiment) WithForce(force int) *Experiment + func (exp *Experiment) WithHashAttribute(hashAttribute string) *Experiment + func (exp *Experiment) WithNamespace(namespace *Namespace) *Experiment + func (exp *Experiment) WithVariations(variations ...FeatureValue) *Experiment + func (exp *Experiment) WithWeights(weights ...float64) *Experiment + type ExperimentCallback func(experiment *Experiment, result *ExperimentResult) + type ExperimentResult struct + HashAttribute string + HashValue string + InExperiment bool + Value FeatureValue + VariationID int + func BuildExperimentResult(dict map[string]interface{}) *ExperimentResult + type Feature struct + DefaultValue FeatureValue + Rules []*FeatureRule + func BuildFeature(val interface{}) *Feature + func ParseFeature(data []byte) *Feature + type FeatureMap map[string]*Feature + func BuildFeatureMap(dict map[string]interface{}) FeatureMap + func ParseFeatureMap(data []byte) FeatureMap + type FeatureResult struct + Experiment *Experiment + ExperimentResult *ExperimentResult + Off bool + On bool + Source FeatureResultSource + Value FeatureValue + func BuildFeatureResult(dict map[string]interface{}) *FeatureResult + func (fr *FeatureResult) GetValueWithDefault(def FeatureValue) FeatureValue + type FeatureResultSource uint + const DefaultValueResultSource + const ExperimentResultSource + const ForceResultSource + const UnknownFeatureResultSource + func ParseFeatureResultSource(source string) FeatureResultSource + type FeatureRule struct + Condition Condition + Coverage *float64 + Force FeatureValue + HashAttribute *string + Namespace *Namespace + TrackingKey *string + Variations []FeatureValue + Weights []float64 + func BuildFeatureRule(val interface{}) *FeatureRule + type FeatureValue interface + func BuildFeatureValues(val interface{}) []FeatureValue + type ForcedVariationsMap map[string]int + type GrowthBook struct + func New(context *Context) *GrowthBook + func (gb *GrowthBook) Attributes() Attributes + func (gb *GrowthBook) ClearSavedResults() + func (gb *GrowthBook) ClearTrackingData() + func (gb *GrowthBook) Enabled() bool + func (gb *GrowthBook) Feature(key string) *FeatureResult + func (gb *GrowthBook) Features() FeatureMap + func (gb *GrowthBook) ForcedVariations() ForcedVariationsMap + func (gb *GrowthBook) GetAllResults() map[string]*ExperimentResult + func (gb *GrowthBook) Run(exp *Experiment) *ExperimentResult + func (gb *GrowthBook) Subscribe(callback ExperimentCallback) func() + func (gb *GrowthBook) URL() *url.URL + func (gb *GrowthBook) WithAttributes(attrs Attributes) *GrowthBook + func (gb *GrowthBook) WithEnabled(enabled bool) *GrowthBook + func (gb *GrowthBook) WithFeatures(features FeatureMap) *GrowthBook + func (gb *GrowthBook) WithForcedVariations(forcedVariations ForcedVariationsMap) *GrowthBook + func (gb *GrowthBook) WithURL(url *url.URL) *GrowthBook + type Logger interface + Error func(msg string, args ...interface{}) + Errorf func(format string, args ...interface{}) + Info func(msg string, args ...interface{}) + Infof func(format string, args ...interface{}) + Warn func(msg string, args ...interface{}) + Warnf func(format string, args ...interface{}) + type Namespace struct + End float64 + ID string + Start float64 + func BuildNamespace(val interface{}) *Namespace + func ParseNamespace(data []byte) *Namespace + type VariationRange struct + Max float64 + Min float64