Versions in this module Expand all Collapse all v0 v0.1.9 Oct 9, 2023 v0.1.8 Oct 8, 2023 v0.1.7 Sep 16, 2023 v0.1.6 Sep 16, 2023 v0.1.5 Aug 7, 2023 Changes in this version type FeatureAPIResponse + Status int v0.1.4 Aug 5, 2023 Changes in this version + func BuildFeatures(v interface{}) map[string]*Feature + func ConfigureCache(c Cache) + func ConfigureCacheBackgroundSync(bgSync bool) + type Assignment struct + Experiment *Experiment + Result *Result + type Cache interface + Clear func() + Get func(key RepositoryKey) *CacheEntry + Initialize func() + Set func(key RepositoryKey, entry *CacheEntry) + type CacheEntry struct + Data *FeatureAPIResponse + StaleAt time.Time + Version time.Time type Context + APIHost string + CacheTTL time.Duration + ClientKey string + DecryptionKey string + DevMode bool + Groups map[string]bool + OnFeatureUsage FeatureUsageCallback + Overrides ExperimentOverrides + UserAttributes Attributes + func (ctx *Context) ForceVariation(key string, variation int) + func (ctx *Context) UnforceVariation(key string) + func (ctx *Context) WithAPIHost(host string) *Context + func (ctx *Context) WithCacheTTL(ttl time.Duration) *Context + func (ctx *Context) WithClientKey(key string) *Context + func (ctx *Context) WithDecryptionKey(key string) *Context + func (ctx *Context) WithDevMode(devMode bool) *Context + func (ctx *Context) WithFeatureUsageCallback(callback FeatureUsageCallback) *Context + func (ctx *Context) WithGroups(groups map[string]bool) *Context + func (ctx *Context) WithOverrides(overrides ExperimentOverrides) *Context + func (ctx *Context) WithUserAttributes(attributes Attributes) *Context type Experiment + Filters []Filter + Groups []string + HashVersion int + Include func() bool + Meta []VariationMeta + Name string + Phase string + Ranges []Range + Seed string + Status ExperimentStatus + URL *regexp.Regexp + URLPatterns []URLTarget + func (exp *Experiment) WithFilters(filters ...Filter) *Experiment + func (exp *Experiment) WithGroups(groups ...string) *Experiment + func (exp *Experiment) WithHashVersion(hashVersion int) *Experiment + func (exp *Experiment) WithIncludeFunction(include func() bool) *Experiment + func (exp *Experiment) WithMeta(meta ...VariationMeta) *Experiment + func (exp *Experiment) WithName(name string) *Experiment + func (exp *Experiment) WithPhase(phase string) *Experiment + func (exp *Experiment) WithRanges(ranges ...Range) *Experiment + func (exp *Experiment) WithSeed(seed string) *Experiment + func (exp *Experiment) WithStatus(status ExperimentStatus) *Experiment + func (exp *Experiment) WithURL(url *regexp.Regexp) *Experiment + type ExperimentOverride struct + Active *bool + Condition Condition + Coverage *float64 + Force *int + Groups []string + Namespace *Namespace + Status *ExperimentStatus + URL *regexp.Regexp + Weights []float64 + type ExperimentOverrides map[string]*ExperimentOverride + type ExperimentStatus string + const DraftStatus + const RunningStatus + const StoppedStatus + type FeatureAPIResponse struct + DateUpdated time.Time + EncryptedFeatures string + Features map[string]*Feature + func BuildFeatureAPIResponse(dict map[string]interface{}) *FeatureAPIResponse + func ParseFeatureAPIResponse(data []byte) *FeatureAPIResponse + func (r *FeatureAPIResponse) MarshalJSON() ([]byte, error) + func (r *FeatureAPIResponse) UnmarshalJSON(data []byte) error + type FeatureRepoOptions struct + AutoRefresh bool + SkipCache bool + Timeout time.Duration type FeatureResult + RuleID string type FeatureResultSource + const OverrideResultSource + const UnknownResultSource type FeatureRule + Filters []Filter + HashVersion int + ID string + Key string + Meta []VariationMeta + Name string + Phase string + Range *Range + Ranges []Range + Seed string + type FeatureUsageCallback func(key string, result *FeatureResult) + type Filter struct + Attribute string + HashVersion int + Ranges []Range + Seed string type GrowthBook + func (gb *GrowthBook) EvalFeature(id string) *FeatureResult + func (gb *GrowthBook) ForceVariation(key string, variation int) + func (gb *GrowthBook) GetAPIInfo() (string, string) + func (gb *GrowthBook) GetFeatureValue(key string, defaultValue interface{}) interface{} + func (gb *GrowthBook) IsOff(key string) bool + func (gb *GrowthBook) IsOn(key string) bool + func (gb *GrowthBook) LatestFeatureUpdate() *time.Time + func (gb *GrowthBook) LoadFeatures(options *FeatureRepoOptions) + func (gb *GrowthBook) Ready() bool + func (gb *GrowthBook) RefreshFeatures(options *FeatureRepoOptions) + func (gb *GrowthBook) UnforceVariation(key string) + func (gb *GrowthBook) WithAPIHost(host string) *GrowthBook + func (gb *GrowthBook) WithAttributeOverrides(overrides Attributes) *GrowthBook + func (gb *GrowthBook) WithClientKey(key string) *GrowthBook + func (gb *GrowthBook) WithDecryptionKey(key string) *GrowthBook + func (gb *GrowthBook) WithDevMode(devMode bool) *GrowthBook + func (gb *GrowthBook) WithEncryptedFeatures(encrypted string, key string) (*GrowthBook, error) + func (gb *GrowthBook) WithFeatureUsageCallback(callback FeatureUsageCallback) *GrowthBook + func (gb *GrowthBook) WithForcedFeatures(values map[string]interface{}) *GrowthBook + func (gb *GrowthBook) WithGroups(groups map[string]bool) *GrowthBook + func (gb *GrowthBook) WithQAMode(qaMode bool) *GrowthBook + func (gb *GrowthBook) WithTrackingCallback(callback ExperimentCallback) *GrowthBook + type Range struct + Max float64 + Min float64 + func (r *Range) InRange(n float64) bool + type RepositoryKey string + type Result struct + Bucket *float64 + FeatureID string + HashAttribute string + HashUsed bool + HashValue string + InExperiment bool + Key string + Name string + Passthrough bool + Value FeatureValue + VariationID int + func BuildResult(dict map[string]interface{}) *Result + type URLTarget struct + Include bool + Pattern string + Type URLTargetType + type URLTargetType uint + const RegexURLTarget + const SimpleURLTarget + type VariationMeta struct + Key string + Name string + Passthrough bool v0.1.3 Apr 24, 2023 Changes in this version type ExperimentResult + FeatureID *string + HashUsed bool v0.1.2 Apr 24, 2023 v0.1.1 Apr 20, 2023 Changes in this version + const ErrCtxArrayInAttributes type Context + Valid bool v0.1.0 Jan 25, 2022 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