models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NUMERIC : NUMERIC var
	NUMERIC string = "NUMERIC"
	// STRING : STRING var
	STRING string = "STRING"
	// BOOLEAN : BOOLEAN var
	BOOLEAN string = "BOOLEAN"
)

Functions

func SetCache

func SetCache(featureMap map[string]Feature, propertyMap map[string]Property, segmentMap map[string]Segment)

SetCache : Set Cache

Types

type Cache

type Cache struct {
	FeatureMap  map[string]Feature
	PropertyMap map[string]Property
	SegmentMap  map[string]Segment
}

Cache : Cache struct

var CacheInstance *Cache

CacheInstance : Cache Instance

func GetCacheInstance

func GetCacheInstance() *Cache

GetCacheInstance : Get Cache Instance

type Collection

type Collection struct {
	Name         string `json:"name"`
	CollectionID string `json:"collection_id"`
}

Collection : Collection struct

type ConfigResponse

type ConfigResponse struct {
	Features   []Feature
	Properties []Property
	Collection Collection
	Segments   []Segment
}

ConfigResponse : ConfigResponse struct

type Feature

type Feature struct {
	Name          string        `json:"name"`
	FeatureID     string        `json:"feature_id"`
	DataType      string        `json:"type"`
	EnabledValue  interface{}   `json:"enabled_value"`
	DisabledValue interface{}   `json:"disabled_value"`
	SegmentRules  []SegmentRule `json:"segment_rules"`
	Enabled       bool          `json:"enabled"`
}

Feature : Feature struct

func (*Feature) GetCurrentValue

func (f *Feature) GetCurrentValue(entityID string, entityAttributes map[string]interface{}) interface{}

GetCurrentValue : Get Current Value

func (*Feature) GetDisabledValue

func (f *Feature) GetDisabledValue() interface{}

GetDisabledValue : Get Disabled Value

func (*Feature) GetEnabledValue

func (f *Feature) GetEnabledValue() interface{}

GetEnabledValue : Get Enabled Value

func (*Feature) GetFeatureDataType

func (f *Feature) GetFeatureDataType() string

GetFeatureDataType : Get Feature Data Type

func (*Feature) GetFeatureID added in v0.1.1

func (f *Feature) GetFeatureID() string

GetFeatureID : Get Feature ID

func (*Feature) GetFeatureName

func (f *Feature) GetFeatureName() string

GetFeatureName : Get Feature Name

func (*Feature) GetSegmentRules

func (f *Feature) GetSegmentRules() []SegmentRule

GetSegmentRules : Get Segment Rules

func (*Feature) IsEnabled

func (f *Feature) IsEnabled() bool

IsEnabled : Is Enabled

type Property

type Property struct {
	Name         string        `json:"name"`
	PropertyID   string        `json:"property_id"`
	DataType     string        `json:"type"`
	Value        interface{}   `json:"value"`
	SegmentRules []SegmentRule `json:"segment_rules"`
}

Property : Property struct

func (*Property) GetCurrentValue

func (f *Property) GetCurrentValue(entityID string, entityAttributes map[string]interface{}) interface{}

GetCurrentValue : Get Current Value

func (*Property) GetPropertyDataType

func (f *Property) GetPropertyDataType() string

GetPropertyDataType : Get Property Data Type

func (*Property) GetPropertyID added in v0.1.1

func (f *Property) GetPropertyID() string

GetPropertyID : Get Property Id

func (*Property) GetPropertyName

func (f *Property) GetPropertyName() string

GetPropertyName : Get Property Name

func (*Property) GetSegmentRules

func (f *Property) GetSegmentRules() []SegmentRule

GetSegmentRules : Get Segment Rules

func (*Property) GetValue

func (f *Property) GetValue() interface{}

GetValue : Get Value

type Rule

type Rule struct {
	Values        []interface{} `json:"values"`
	Operator      string
	AttributeName string `json:"Attribute_Name"`
}

Rule : Rule struct

func (*Rule) EvaluateRule

func (r *Rule) EvaluateRule(entityAttributes map[string]interface{}) bool

EvaluateRule : Evaluate Rule

func (*Rule) GetAttributeName

func (r *Rule) GetAttributeName() string

GetAttributeName : Get Attribute Name

func (*Rule) GetOperator

func (r *Rule) GetOperator() string

GetOperator : Get Operator

func (*Rule) GetValues

func (r *Rule) GetValues() []interface{}

GetValues : Get Values

type RuleElem

type RuleElem struct {
	Segments []string
}

RuleElem : RuleElem struct

type Segment

type Segment struct {
	Name      string `json:"name"`
	SegmentID string `json:"segment_id"`
	Rules     []Rule `json:"rules"`
}

Segment : Segment struct

func (*Segment) EvaluateRule

func (s *Segment) EvaluateRule(entityAttributes map[string]interface{}) bool

EvaluateRule : Evaluate Rule

func (*Segment) GetName

func (s *Segment) GetName() string

GetName : Get Name

func (*Segment) GetRules

func (s *Segment) GetRules() []Rule

GetRules : Get Rules

func (*Segment) GetSegmentID added in v0.1.1

func (s *Segment) GetSegmentID() string

GetSegmentID : Get SegmentID

type SegmentRule

type SegmentRule struct {
	Rules []RuleElem
	Value interface{}
	Order int
}

SegmentRule : SegmentRule struct

func (*SegmentRule) GetOrder

func (sr *SegmentRule) GetOrder() int

GetOrder : Get Order

func (*SegmentRule) GetRules

func (sr *SegmentRule) GetRules() []RuleElem

GetRules : Get Rules

func (*SegmentRule) GetValue

func (sr *SegmentRule) GetValue() interface{}

GetValue : Get Value

Jump to

Keyboard shortcuts

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