eval

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeatureTypes

func FeatureTypes() []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 NewFeatureOnForUserIDBeta2

func NewFeatureOnForUserIDBeta2() *featurev1beta1.Feature

func NewFeatureOnForUserIDsBeta2

func NewFeatureOnForUserIDsBeta2() *featurev1beta1.Feature

func NewRuleLangContainsUserID

func NewRuleLangContainsUserID() string

func NewRuleLangEqualUserID

func NewRuleLangEqualUserID() string

Types

type EvaluableFeature

type EvaluableFeature interface {
	// Evaluate Feature 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 feature type (bool, string, json, proto, etc)
	// or "" if the type is not supported
	Type() FeatureType
}

func NewV1Beta3

func NewV1Beta3(f *featurev1beta1.Feature, namespace string) EvaluableFeature

type FeatureType

type FeatureType string

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

const (
	FeatureTypeBool   FeatureType = "bool"
	FeatureTypeInt    FeatureType = "int"
	FeatureTypeFloat  FeatureType = "float"
	FeatureTypeString FeatureType = "string"
	FeatureTypeProto  FeatureType = "proto"
	FeatureTypeJSON   FeatureType = "json"
)

func FeatureTypeFromProto

func FeatureTypeFromProto(ft featurev1beta1.FeatureType) FeatureType

func (FeatureType) IsPrimitive

func (ft FeatureType) IsPrimitive() bool

func (FeatureType) ToProto

func (ft FeatureType) ToProto() featurev1beta1.FeatureType

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