View Source GrowthBook.FeatureResult (GrowthBook v0.3.0)

Struct holding results of an evaluated Feature.

Holds the result of a feature evaluation, and is used to check if a feature is enabled, and optionally what data it provides, if that was configured.

Link to this section Summary

Types

The source of a feature

t()

Feature result

Functions

Helper function to convert string sources to atoms

Link to this section Types

Specs

source() ::
  :unknown_feature
  | :cyclic_prerequisite
  | :prerequisite
  | :default_value
  | :force
  | :experiment

The source of a feature

Specs

t() :: %GrowthBook.FeatureResult{
  experiment: GrowthBook.Experiment.t() | nil,
  experiment_result: GrowthBook.ExperimentResult.t() | nil,
  off: boolean(),
  off?: boolean(),
  on: boolean(),
  on?: boolean(),
  source: source(),
  value: term()
}

Feature result

The result of evaluating a GrowthBook.Feature. Has a number of keys:

  • value (term/0) - The assigned value of the feature
  • on/on? (boolean/0) - The assigned value cast to a boolean
  • off/off? (boolean/0) - The assigned value cast to a boolean and then negated
  • source (source/0) - The source of the feature result
  • experiment (GrowthBook.Experiment.t/0 or nil) - When source is :experiment, this will be an %GrowthBook.Experiment{} struct
  • experiment_result (GrowthBook.ExperimentResult.t/0 or nil) - When source is :experiment, this will be an %GrowthBook.ExperimentResult{} struct

Link to this section Functions

Link to this function

feature_source_from_string(arg1)

View Source

Specs

feature_source_from_string(String.t()) :: source()

Helper function to convert string sources to atoms