grammar

package
v8.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConditionTypeWhitelist represents a normal condition
	ConditionTypeWhitelist = "WHITELIST"
	// ConditionTypeRollout represents a condition that will return default if traffic allocatio is exceeded
	ConditionTypeRollout = "ROLLOUT"

	// MatcherCombinerAnd represents that all matchers in the group are required
	MatcherCombinerAnd = 0
)

Variables

View Source
var ErrInvalidEqualSemver = errors.New("semver is required for EQUAL_TO_SEMVER matcher type")
View Source
var ErrInvalidGTOESemver = errors.New("semver is required for GREATER_THAN_OR_EQUAL_TO_SEMVER matcher type")
View Source
var ErrInvalidLBetweenSemver = errors.New("semver is required for BETWEEN_SEMVER matcher type")
View Source
var ErrInvalidLInListSemver = errors.New("semver is required for IN_LIST_SEMVER matcher type")
View Source
var ErrInvalidLTOESemver = errors.New("semver is required for LESS_THAN_OR_EQUAL_TO_SEMVER matcher type")

Functions

This section is empty.

Types

type AllKeysMatcher

type AllKeysMatcher struct {
	Matcher
}

AllKeysMatcher matches any given key and set of attributes

func NewAllKeysMatcher

func NewAllKeysMatcher(negate bool) *AllKeysMatcher

NewAllKeysMatcher returns a pointer to a new instance of AllKeysMatcher

func (AllKeysMatcher) Match

func (m AllKeysMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match implementation for AllKeysMatcher

type BetweenMatcher

type BetweenMatcher struct {
	Matcher
	ComparisonDataType   string
	LowerComparisonValue int64
	UpperComparisonValue int64
}

BetweenMatcher will match if two numbers or two datetimes are equal

func NewBetweenMatcher

func NewBetweenMatcher(negate bool, lower int64, upper int64, cmpType string, attributeName *string) *BetweenMatcher

NewBetweenMatcher returns a pointer to a new instance of BetweenMatcher

func (*BetweenMatcher) Match

func (m *BetweenMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the matchingValue is between lowerComparisonValue and upperComparisonValue

type BetweenSemverMatcher

type BetweenSemverMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

BetweenSemverMatcher struct to hold the semver to compare

func NewBetweenSemverMatcher

func NewBetweenSemverMatcher(startVal string, endVal string, negate bool, attributeName *string, logger logging.LoggerInterface) *BetweenSemverMatcher

NewBetweenSemverMatcher returns a pointer to a new instance of BetweenSemverMatcher

func (*BetweenSemverMatcher) Match

func (b *BetweenSemverMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is between to the matchingValue

type BooleanMatcher

type BooleanMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

BooleanMatcher returns true if the value supplied can be interpreted as a boolean and is equal to the one stored

func NewBooleanMatcher

func NewBooleanMatcher(negate bool, value *bool, attributeName *string) *BooleanMatcher

NewBooleanMatcher instantiates a new BooleanMatcher

func (*BooleanMatcher) Match

func (m *BooleanMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the value supplied can be interpreted as a boolean and is equal to the one stored

type Condition

type Condition struct {
	// contains filtered or unexported fields
}

Condition struct with added logic that wraps around a DTO

func BuildCondition

func BuildCondition(conditionType string, label string, partitions []Partition, matchers []MatcherInterface, combiner string) *Condition

func NewCondition

func NewCondition(cond *dtos.ConditionDTO, logger logging.LoggerInterface, ruleBuilder RuleBuilder) (*Condition, error)

NewCondition instantiates a new Condition struct with appropriate wrappers around dtos and returns it.

func NewRBCondition

func NewRBCondition(cond *dtos.RuleBasedConditionDTO, logger logging.LoggerInterface, ruleBuilder RuleBuilder) (*Condition, error)

func (*Condition) CalculateTreatment

func (c *Condition) CalculateTreatment(bucket int) *string

CalculateTreatment calulates the treatment for a specific condition based on the bucket

func (*Condition) Combiner

func (c *Condition) Combiner() string

func (*Condition) ConditionType

func (c *Condition) ConditionType() string

ConditionType returns validated condition type. Whitelist by default

func (*Condition) Label

func (c *Condition) Label() string

Label returns the condition's label

func (*Condition) Matches

func (c *Condition) Matches(key string, bucketingKey *string, attributes map[string]interface{}) bool

Matches returns true if the condition matches for a specific key and/or set of attributes

type ContainsAllOfSetMatcher

type ContainsAllOfSetMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

ContainsAllOfSetMatcher matches if the set supplied to the getTreatment is a superset of the one in the feature flag

func NewContainsAllOfSetMatcher

func NewContainsAllOfSetMatcher(negate bool, setItems []string, attributeName *string) *ContainsAllOfSetMatcher

NewContainsAllOfSetMatcher returns a pointer to a new instance of ContainsAllOfSetMatcher

func (*ContainsAllOfSetMatcher) Match

func (m *ContainsAllOfSetMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the set provided is a superset of the one in the feature flag

type ContainsAnyOfSetMatcher

type ContainsAnyOfSetMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

ContainsAnyOfSetMatcher matches if the set supplied to the getTreatment is a superset of the one in the feature flag

func NewContainsAnyOfSetMatcher

func NewContainsAnyOfSetMatcher(negate bool, setItems []string, attributeName *string) *ContainsAnyOfSetMatcher

NewContainsAnyOfSetMatcher returns a pointer to a new instance of ContainsAnyOfSetMatcher

func (*ContainsAnyOfSetMatcher) Match

func (m *ContainsAnyOfSetMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the set provided is a superset of the one in the feature flag

type ContainsStringMatcher

type ContainsStringMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

ContainsStringMatcher matches strings contain one of the substrings in the feature flag

func NewContainsStringMatcher

func NewContainsStringMatcher(negate bool, substrings []string, attributeName *string) *ContainsStringMatcher

NewContainsStringMatcher returns a new instance of ContainsStringMatcher

func (*ContainsStringMatcher) Match

func (m *ContainsStringMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key contains one of the substrings in the feature flag

type DependencyMatcher

type DependencyMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

DependencyMatcher will match if the evaluation of another split results in one of the treatments defined in the feature flag

func NewDependencyMatcher

func NewDependencyMatcher(negate bool, feature string, treatments []string, deedependencyEvaluator dependencyEvaluator) *DependencyMatcher

NewDependencyMatcher will return a new instance of DependencyMatcher

func (*DependencyMatcher) Match

func (m *DependencyMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will return true if the evaluation of another split results in one of the treatments defined in the feature flag

type EndsWithMatcher

type EndsWithMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

EndsWithMatcher matches strings which end with one of the suffixes in the feature flag

func NewEndsWithMatcher

func NewEndsWithMatcher(negate bool, suffixes []string, attributeName *string) *EndsWithMatcher

NewEndsWithMatcher returns a new instance of EndsWithMatcher

func (*EndsWithMatcher) Match

func (m *EndsWithMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key provided ends with one of the suffixes in the feature flag.

type EqualToMatcher

type EqualToMatcher struct {
	Matcher
	ComparisonDataType string
	ComparisonValue    int64
}

EqualToMatcher will match if two numbers or two datetimes are equal

func NewEqualToMatcher

func NewEqualToMatcher(negate bool, cmpVal int64, cmpType string, attributeName *string) *EqualToMatcher

NewEqualToMatcher returns a pointer to a new instance of EqualToMatcher

func (*EqualToMatcher) Match

func (m *EqualToMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is equal to the matchingValue

type EqualToSemverMatcher

type EqualToSemverMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

EqualToSemverMatcher struct to hold the semver to compare

func NewEqualToSemverMatcher

func NewEqualToSemverMatcher(cmpVal string, negate bool, attributeName *string, logger logging.LoggerInterface) *EqualToSemverMatcher

NewEqualToSemverMatcher returns a pointer to a new instance of EqualToSemverMatcher

func (*EqualToSemverMatcher) Match

func (e *EqualToSemverMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is equal to the matchingValue

type EqualToSetMatcher

type EqualToSetMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

EqualToSetMatcher matches if the set supplied to the getTreatment is equal to the one in the feature flag

func NewEqualToSetMatcher

func NewEqualToSetMatcher(negate bool, setItems []string, attributeName *string) *EqualToSetMatcher

NewEqualToSetMatcher returns a pointer to a new instance of EqualToSetMatcher

func (*EqualToSetMatcher) Match

func (m *EqualToSetMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the match provided and the one in the feature flag are equal

type GreaterThanOrEqualToMatcher

type GreaterThanOrEqualToMatcher struct {
	Matcher
	ComparisonDataType string
	ComparisonValue    int64
}

GreaterThanOrEqualToMatcher will match if two numbers or two datetimes are equal

func NewGreaterThanOrEqualToMatcher

func NewGreaterThanOrEqualToMatcher(negate bool, cmpVal int64, cmpType string, attributeName *string) *GreaterThanOrEqualToMatcher

NewGreaterThanOrEqualToMatcher returns a pointer to a new instance of GreaterThanOrEqualToMatcher

func (*GreaterThanOrEqualToMatcher) Match

func (m *GreaterThanOrEqualToMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is greater than or equal to the matchingValue

type GreaterThanOrEqualToSemverMatcher

type GreaterThanOrEqualToSemverMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

GreaterThanOrEqualToSemverMatcher struct to hold the semver to compare

func NewGreaterThanOrEqualToSemverMatcher

func NewGreaterThanOrEqualToSemverMatcher(negate bool, compareTo string, attributeName *string, logger logging.LoggerInterface) *GreaterThanOrEqualToSemverMatcher

NewGreaterThanOrEqualToSemverMatcher returns an instance of GreaterThanOrEqualToSemverMatcher

func (*GreaterThanOrEqualToSemverMatcher) Match

func (g *GreaterThanOrEqualToSemverMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match compares the semver of the key with the semver in the feature flag

type InLargeSegmentMatcher

type InLargeSegmentMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

InLargeSegmentMatcher matches if the key passed is in the large segment which the matcher was constructed with

func NewInLargeSegmentMatcher

func NewInLargeSegmentMatcher(negate bool, name string, attributeName *string, largeSegmentStorage storage.LargeSegmentStorageConsumer) *InLargeSegmentMatcher

NewInLargeSegmentMatcher instantiates a new InLargeSegmentMatcher

func (*InLargeSegmentMatcher) Match

func (m *InLargeSegmentMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key is in the matcher's segment

type InListSemverMatcher

type InListSemverMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

InListSemverMatcher struct to hold the semver to compare

func NewInListSemverMatcher

func NewInListSemverMatcher(setVersions []string, negate bool, attributeName *string, logger logging.LoggerInterface) *InListSemverMatcher

NewInListSemverMatcher returns a pointer to a new instance of InListSemverMatcher

func (*InListSemverMatcher) Match

func (i *InListSemverMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is in list to the matchingValue

type InRuleBasedSegmentMatcher

type InRuleBasedSegmentMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

InRuleBasedsegmentMatcher matches if the key passed is in the rule-based segment which the matcher was constructed with

func NewInRuleBasedSegmentMatcher

func NewInRuleBasedSegmentMatcher(negate bool, name string, attributeName *string, ruleBuilder RuleBuilder) *InRuleBasedSegmentMatcher

NewInRuleBasedSegmentMatcher instantiates a new InRuleBasedSegmentMatcher

func (*InRuleBasedSegmentMatcher) Match

func (m *InRuleBasedSegmentMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key is in the matcher's rule-based segment

type InSegmentMatcher

type InSegmentMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

InSegmentMatcher matches if the key passed is in the segment which the matcher was constructed with

func NewInSegmentMatcher

func NewInSegmentMatcher(negate bool, segmentName string, attributeName *string, segmentStorage storage.SegmentStorageConsumer) *InSegmentMatcher

NewInSegmentMatcher instantiates a new InSegmentMatcher

func (*InSegmentMatcher) Match

func (m *InSegmentMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key is in the matcher's segment

type LessThanOrEqualToMatcher

type LessThanOrEqualToMatcher struct {
	Matcher
	ComparisonDataType string
	ComparisonValue    int64
}

LessThanOrEqualToMatcher will match if two numbers or two datetimes are equal

func NewLessThanOrEqualToMatcher

func NewLessThanOrEqualToMatcher(negate bool, cmpVal int64, cmpType string, attributeName *string) *LessThanOrEqualToMatcher

NewLessThanOrEqualToMatcher returns a pointer to a new instance of LessThanOrEqualToMatcher

func (*LessThanOrEqualToMatcher) Match

func (m *LessThanOrEqualToMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is less than or equal to the matchingValue

type LessThanOrEqualToSemverMatcher

type LessThanOrEqualToSemverMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

LessThanOrEqualToSemverMatcher struct to hold the semver to compare

func NewLessThanOrEqualToSemverMatcher

func NewLessThanOrEqualToSemverMatcher(compareTo string, negate bool, attributeName *string, logger logging.LoggerInterface) *LessThanOrEqualToSemverMatcher

NewLessThanOrEqualToSemverMatcher returns a pointer to a new instance of LessThanOrEqualToSemverMatcher

func (*LessThanOrEqualToSemverMatcher) Match

func (l *LessThanOrEqualToSemverMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match will match if the comparisonValue is less or equal to the matchingValue

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher struct with added logic that wraps around a DTO

func (*Matcher) Negate

func (m *Matcher) Negate() bool

Negate returns whether this mather is negated or not

type MatcherInterface

type MatcherInterface interface {
	Match(key string, attributes map[string]interface{}, bucketingKey *string) bool
	Negate() bool
	// contains filtered or unexported methods
}

MatcherInterface should be implemented by all matchers

type PartOfSetMatcher

type PartOfSetMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

PartOfSetMatcher matches if the set supplied to the getTreatment is a subset of the one in the feature flag

func NewPartOfSetMatcher

func NewPartOfSetMatcher(negate bool, setItems []string, attributeName *string) *PartOfSetMatcher

NewPartOfSetMatcher returns a pointer to a new instance of PartOfSetMatcher

func (*PartOfSetMatcher) Match

func (m *PartOfSetMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the match provided is a subset of the one in the feature flasg

type Partition

type Partition struct {
	PartitionData dtos.PartitionDTO
}

Partition struct with added logic that wraps around a DTO

type PrerequisitesMatcher

type PrerequisitesMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

func NewPrerequisitesMatcher

func NewPrerequisitesMatcher(prerequisistes []dtos.Prerequisite, dependencyEvaluator dependencyEvaluator) *PrerequisitesMatcher

NewPrerequisitesMatcher will return a new instance of PrerequisitesMatcher

func (*PrerequisitesMatcher) Match

func (m *PrerequisitesMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if prerequisistes match

type RegexMatcher

type RegexMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

RegexMatcher matches if the supplied key matches the feature flag's regex

func NewRegexMatcher

func NewRegexMatcher(negate bool, regex string, attributeName *string) *RegexMatcher

NewRegexMatcher returns a new instance to a RegexMatcher

func (*RegexMatcher) Match

func (m *RegexMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the supplied key matches the feature flag's regex

type RuleBuilder

type RuleBuilder struct {
	// contains filtered or unexported fields
}

func NewRuleBuilder

func NewRuleBuilder(segmentStorage storage.SegmentStorageConsumer, ruleBasedSegmentStorage storage.RuleBasedSegmentStorageConsumer, largeSegmentStorage storage.LargeSegmentStorageConsumer, ffAcceptedMatchers []string, rbAcceptedMatchers []string, logger logging.LoggerInterface, dedependencyEvaluator dependencyEvaluator) RuleBuilder

func (RuleBuilder) BuildMatcher

func (r RuleBuilder) BuildMatcher(dto *dtos.MatcherDTO) (MatcherInterface, error)

func (RuleBuilder) BuildPrerequistesMatchers

func (r RuleBuilder) BuildPrerequistesMatchers(prerequistes []dtos.Prerequisite) *PrerequisitesMatcher

type Split

type Split struct {
	// contains filtered or unexported fields
}

Split struct with added logic that wraps around a DTO

func NewSplit

func NewSplit(splitDTO *dtos.SplitDTO, logger logging.LoggerInterface, ruleBuilder RuleBuilder) *Split

NewSplit instantiates a new Split object and all it's internal structures mapped to model classes

func (*Split) Algo

func (s *Split) Algo() int

Algo returns the hashing algorithm configured for this feature flag

func (*Split) ChangeNumber

func (s *Split) ChangeNumber() int64

ChangeNumber returns the change number for this feature flag

func (*Split) Conditions

func (s *Split) Conditions() []*Condition

Conditions returns a slice of Condition objects

func (*Split) Configurations

func (s *Split) Configurations() map[string]string

Configurations returns the configurations for this feature flag

func (*Split) DefaultTreatment

func (s *Split) DefaultTreatment() string

DefaultTreatment returns the default treatment for the current feature flag

func (*Split) ImpressionsDisabled

func (s *Split) ImpressionsDisabled() bool

func (*Split) Killed

func (s *Split) Killed() bool

Killed returns whether the feature flag has been killed or not

func (*Split) Name

func (s *Split) Name() string

Name returns the name of the feature

func (*Split) Prerequisites

func (s *Split) Prerequisites() *PrerequisitesMatcher

func (*Split) Seed

func (s *Split) Seed() int64

Seed returns the seed use for hashing

func (*Split) Status

func (s *Split) Status() string

Status returns whether the feature flag is active or arhived

func (*Split) TrafficAllocation

func (s *Split) TrafficAllocation() int

TrafficAllocation returns the traffic allocation configured for the current feature flag

func (*Split) TrafficAllocationSeed

func (s *Split) TrafficAllocationSeed() int64

TrafficAllocationSeed returns the seed for traffic allocation configured for this feature flag

type StartsWithMatcher

type StartsWithMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

StartsWithMatcher matches strings which start with one of the prefixes in the feature flag

func NewStartsWithMatcher

func NewStartsWithMatcher(negate bool, prefixes []string, attributeName *string) *StartsWithMatcher

NewStartsWithMatcher returns a new instance of StartsWithMatcher

func (*StartsWithMatcher) Match

func (m *StartsWithMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key provided starts with one of the prefixes in the feature flag.

type WhitelistMatcher

type WhitelistMatcher struct {
	Matcher
	// contains filtered or unexported fields
}

WhitelistMatcher matches if the key received is present in the matcher's whitelist

func NewWhitelistMatcher

func NewWhitelistMatcher(negate bool, whitelist []string, attributeName *string) *WhitelistMatcher

NewWhitelistMatcher returns a new WhitelistMatcher

func (*WhitelistMatcher) Match

func (m *WhitelistMatcher) Match(key string, attributes map[string]interface{}, bucketingKey *string) bool

Match returns true if the key is present in the whitelist.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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