entities

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package entities //

Package entities //

Package entities //

Package entities //

Package entities //

Package entities //

Package entities //

Package entities //

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	ID  string
	Key string
}

Attribute contains the user attribute definition

type Audience

type Audience struct {
	ID            string
	Name          string
	ConditionTree *TreeNode
	Conditions    interface{}
}

Audience contains the audience definition

type Condition

type Condition struct {
	Name                 string      `json:"name"`
	Match                string      `json:"match"`
	Type                 string      `json:"type"`
	Value                interface{} `json:"value"`
	StringRepresentation string
}

Condition has condition info

type Event

type Event struct {
	ID            string   `json:"id"`
	Key           string   `json:"key"`
	ExperimentIds []string `json:"experimentIds"`
}

Event represents a conversion event

type Experiment

type Experiment struct {
	AudienceIds           []string
	AudienceConditions    interface{}
	ID                    string
	LayerID               string
	Key                   string
	Variations            map[string]Variation // keyed by variation ID
	VariationKeyToIDMap   map[string]string
	TrafficAllocation     []Range
	GroupID               string
	AudienceConditionTree *TreeNode
	Whitelist             map[string]string
	IsFeatureExperiment   bool
	Revision              int
}

Experiment represents an experiment

type Feature

type Feature struct {
	ID                 string
	Key                string
	FeatureExperiments []Experiment
	ExperimentIDs      []string
	Rollout            Rollout
	VariableMap        map[string]Variable
}

Feature represents a feature flag

type Group

type Group struct {
	ID                string
	TrafficAllocation []Range
	Policy            string
}

Group represents a grouping of entities and their traffic allocation ranges

type Range

type Range struct {
	EntityID   string
	EndOfRange int
}

Range represents bucketing range that the specify entityID falls into

type Rollout

type Rollout struct {
	ID          string
	Experiments []Experiment
}

Rollout represents a feature rollout

type TreeNode

type TreeNode struct {
	Item     interface{} // can be a condition or a string
	Operator string

	Nodes []*TreeNode
}

TreeNode in a condition tree

type TreeParameters

type TreeParameters struct {
	User        *UserContext
	AudienceMap map[string]Audience
}

TreeParameters represents parameters of a tree

func NewTreeParameters

func NewTreeParameters(user *UserContext, audience map[string]Audience) *TreeParameters

NewTreeParameters returns TreeParameters object

type UserContext

type UserContext struct {
	ID         string
	Attributes map[string]interface{}
}

UserContext holds information about a user

func (UserContext) CheckAttributeExists

func (u UserContext) CheckAttributeExists(attrName string) bool

CheckAttributeExists returns whether the specified attribute name exists in the attributes map.

func (UserContext) GetAttribute

func (u UserContext) GetAttribute(attrName string) (interface{}, error)

GetAttribute returns the value for the specified attribute name in the attributes map. Returns error if not found.

func (UserContext) GetBoolAttribute

func (u UserContext) GetBoolAttribute(attrName string) (bool, error)

GetBoolAttribute returns the bool value for the specified attribute name in the attributes map. Returns error if not found.

func (UserContext) GetBucketingID

func (u UserContext) GetBucketingID() (string, error)

GetBucketingID returns the bucketing ID to use for the given user

func (UserContext) GetFloatAttribute

func (u UserContext) GetFloatAttribute(attrName string) (float64, error)

GetFloatAttribute returns the float64 value for the specified attribute name in the attributes map. Returns error if not found.

func (UserContext) GetIntAttribute

func (u UserContext) GetIntAttribute(attrName string) (int64, error)

GetIntAttribute returns the int64 value for the specified attribute name in the attributes map. Returns error if not found.

func (UserContext) GetStringAttribute

func (u UserContext) GetStringAttribute(attrName string) (string, error)

GetStringAttribute returns the string value for the specified attribute name in the attributes map. Returns error if not found.

type Variable

type Variable struct {
	DefaultValue string
	ID           string
	Key          string
	Type         VariableType
}

Variable represents a feature variable

type VariableType

type VariableType string

VariableType is the type of feature variable

const (
	// String - the feature-variable type is string
	String VariableType = "string"
	// Integer - the feature-variable type is integer
	Integer VariableType = "integer"
	// Double - the feature-variable type is double
	Double VariableType = "double"
	// Boolean - the feature-variable type is boolean
	Boolean VariableType = "boolean"
	// JSON - the feature-variable type is json
	JSON VariableType = "json"
)

type Variation

type Variation struct {
	ID             string
	Variables      map[string]VariationVariable
	Key            string
	FeatureEnabled bool
}

Variation represents a variation in the experiment

type VariationVariable

type VariationVariable struct {
	ID    string
	Value string
}

VariationVariable represents a Variable object from the Variation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL