eval

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Overview

This package governs the specifics of a config, like what individual files make up a config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigTypes added in v0.3.0

func ConfigTypes() []string

func NewAnyFalse

func NewAnyFalse() *anypb.Any

func NewAnyInt

func NewAnyInt(i int64) *anypb.Any

func NewAnyTrue

func NewAnyTrue() *anypb.Any

func NewBasicFeatureOffBeta2

func NewBasicFeatureOffBeta2() *featurev1beta1.Feature

func NewBasicFeatureOnBeta2

func NewBasicFeatureOnBeta2() *featurev1beta1.Feature

func NewComplexTreeFeature

func NewComplexTreeFeature() *featurev1beta1.Feature

func NewConstraintOnForUserIDBeta2

func NewConstraintOnForUserIDBeta2() *featurev1beta1.Constraint

func NewConstraintOnForUserIDsBeta2

func NewConstraintOnForUserIDsBeta2() *featurev1beta1.Constraint

func NewDependencyTreeFeature added in v0.4.0

func NewDependencyTreeFeature() *featurev1beta1.Feature

func NewFeatureOnForUserIDBeta2

func NewFeatureOnForUserIDBeta2() *featurev1beta1.Feature

func NewFeatureOnForUserIDsBeta2

func NewFeatureOnForUserIDsBeta2() *featurev1beta1.Feature

func NewRuleLangContainsUserID

func NewRuleLangContainsUserID() string

func NewRuleLangEqualUserID

func NewRuleLangEqualUserID() string

Types

type ConfigType added in v0.3.0

type ConfigType string

Indicates the lekko-specific types that are allowed in feature flags.

const (
	ConfigTypeBool   ConfigType = "bool"
	ConfigTypeInt    ConfigType = "int"
	ConfigTypeFloat  ConfigType = "float"
	ConfigTypeString ConfigType = "string"
	ConfigTypeProto  ConfigType = "proto"
	ConfigTypeJSON   ConfigType = "json"
)

func ConfigTypeFromProto added in v0.3.0

func ConfigTypeFromProto(ft featurev1beta1.FeatureType) ConfigType

func (ConfigType) IsPrimitive added in v0.3.0

func (ft ConfigType) IsPrimitive() bool

func (ConfigType) ToProto added in v0.3.0

func (ft ConfigType) ToProto() featurev1beta1.FeatureType

type EvaluableConfig added in v0.3.0

type EvaluableConfig interface {
	// Evaluate returns a protobuf.Any.
	// For user defined protos, we shouldn't attempt to Unmarshal
	// this unless we know the type. For primitive types, we can
	// safely unmarshal into BoolValue, StringValue, etc.
	Evaluate(featureCtx map[string]interface{}) (*anypb.Any, ResultPath, error)
	// Returns the config type (bool, string, json, proto, etc)
	// or "" if the type is not supported
	Type() ConfigType
}

func NewV1Beta3

func NewV1Beta3(f *featurev1beta1.Feature, namespace string, referencedConfigToValueMap map[string]*structpb.Value) EvaluableConfig

evaluate constrcutor needs a getter to Config getConfig(key string)

type ResultPath

type ResultPath []int

Stores the path of the tree node that returned the final value after successful evaluation. See the readme for an illustration.

Jump to

Keyboard shortcuts

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