eval

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag added in v0.0.3

type Flag struct {
	State          string          `json:"state"`
	DefaultVariant string          `json:"defaultVariant"`
	Variants       map[string]any  `json:"variants"`
	Targeting      json.RawMessage `json:"targeting"`
}

type Flags

type Flags struct {
	Flags map[string]Flag `json:"flags"`
}

func (Flags) Merge added in v0.0.4

func (f Flags) Merge(ff Flags) Flags

type IEvaluator

type IEvaluator interface {
	GetState() (string, error)
	SetState(state string) error

	ResolveBooleanValue(
		flagKey string,
		context *structpb.Struct) (value bool, variant string, reason string, err error)
	ResolveStringValue(
		flagKey string,
		context *structpb.Struct) (value string, variant string, reason string, err error)
	ResolveNumberValue(flagKey string,
		context *structpb.Struct) (value float32, variant string, reason string, err error)
	ResolveObjectValue(
		flagKey string,
		context *structpb.Struct) (value map[string]any, variant string, reasons string, err error)
}

type JSONEvaluator added in v0.0.3

type JSONEvaluator struct {
	Logger *log.Entry
	// contains filtered or unexported fields
}

func (*JSONEvaluator) GetState added in v0.0.3

func (je *JSONEvaluator) GetState() (string, error)

func (*JSONEvaluator) ResolveBooleanValue added in v0.0.3

func (je *JSONEvaluator) ResolveBooleanValue(flagKey string, context *structpb.Struct) (
	value bool,
	variant string,
	reason string,
	err error,
)

func (*JSONEvaluator) ResolveNumberValue added in v0.0.3

func (je *JSONEvaluator) ResolveNumberValue(flagKey string, context *structpb.Struct) (
	value float32,
	variant string,
	reason string,
	err error,
)

func (*JSONEvaluator) ResolveObjectValue added in v0.0.3

func (je *JSONEvaluator) ResolveObjectValue(flagKey string, context *structpb.Struct) (
	value map[string]any,
	variant string,
	reason string,
	err error,
)

func (*JSONEvaluator) ResolveStringValue added in v0.0.3

func (je *JSONEvaluator) ResolveStringValue(flagKey string, context *structpb.Struct) (
	value string,
	variant string,
	reason string,
	err error,
)

func (*JSONEvaluator) SetState added in v0.0.3

func (je *JSONEvaluator) SetState(state string) error

Directories

Path Synopsis
tests
mocks
Package mock_eval is a generated GoMock package.
Package mock_eval is a generated GoMock package.

Jump to

Keyboard shortcuts

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