segments

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	All  RuleType = "ALL"
	Any  RuleType = "ANY"
	None RuleType = "NONE"

	Equal                ConditionOperator = "EQUAL"
	GreaterThan          ConditionOperator = "GREATER_THAN"
	LessThan             ConditionOperator = "LESS_THAN"
	LessThanInclusive    ConditionOperator = "LESS_THAN_INCLUSIVE"
	Contains             ConditionOperator = "CONTAINS"
	GreaterThanInclusive ConditionOperator = "GREATER_THAN_INCLUSIVE"
	NotContains          ConditionOperator = "NOT_CONTAINS"
	NotEqual             ConditionOperator = "NOT EQUAL"
	Regex                ConditionOperator = "REGEX"
	PercentageSplit      ConditionOperator = "PERCENTAGE_SPLIT"
	IsSet                ConditionOperator = "IS_SET"
	IsNotSet             ConditionOperator = "IS_NOT_SET"
	Modulo               ConditionOperator = "MODULO"
)

Variables

This section is empty.

Functions

func EvaluateIdentityInSegment

func EvaluateIdentityInSegment(
	identity *identities.IdentityModel,
	segment *SegmentModel,
	overrideTraits ...*traits.TraitModel,
) bool

Types

type ConditionOperator

type ConditionOperator string

type RuleType

type RuleType string

type SegmentConditionModel

type SegmentConditionModel struct {
	Operator ConditionOperator `json:"operator"`
	Value    string            `json:"value"`
	Property string            `json:"property_"`
}

func (*SegmentConditionModel) MatchesTraitValue

func (m *SegmentConditionModel) MatchesTraitValue(traitValue string) bool

type SegmentModel

type SegmentModel struct {
	ID            int                           `json:"id"`
	Name          string                        `json:"name"`
	Rules         []*SegmentRuleModel           `json:"rules"`
	FeatureStates []*features.FeatureStateModel `json:"feature_states"`
}

type SegmentRuleModel

type SegmentRuleModel struct {
	Type       RuleType `json:"type"`
	Rules      []*SegmentRuleModel
	Conditions []*SegmentConditionModel
}

func (*SegmentRuleModel) MatchingFunction

func (sr *SegmentRuleModel) MatchingFunction() func([]bool) bool

Jump to

Keyboard shortcuts

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