Documentation ¶
Index ¶
- type BooleanFlag
- type Flags
- type IEvaluator
- type JsonEvaluator
- func (je *JsonEvaluator) GetState() (string, error)
- func (je *JsonEvaluator) ResolveBooleanValue(flagKey string, defaultValue bool) (bool, error)
- func (je *JsonEvaluator) ResolveNumberValue(flagKey string, defaultValue float32) (float32, error)
- func (je *JsonEvaluator) ResolveObjectValue(flagKey string, defaultValue map[string]interface{}) (map[string]interface{}, error)
- func (je *JsonEvaluator) ResolveStringValue(flagKey string, defaultValue string) (string, error)
- func (je *JsonEvaluator) SetState(state string) error
- type NumberFlag
- type ObjectFlag
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BooleanFlag ¶
type Flags ¶
type Flags struct { BooleanFlags map[string]BooleanFlag `json:"booleanFlags"` StringFlags map[string]StringFlag `json:"stringFlags"` NumericFlags map[string]NumberFlag `json:"numericFlags"` ObjectFlags map[string]ObjectFlag `json:"objectFlags"` }
TODO: use some composition/interfaces here to reduce duplication, but we'll have to customize the marshalling
type IEvaluator ¶
type IEvaluator interface { // TODO: add context param when rule evaluator is implemented GetState() (string, error) SetState(state string) error ResolveBooleanValue(flagKey string, defaultValue bool) (bool, error) ResolveStringValue(flagKey string, defaultValue string) (string, error) ResolveNumberValue(flagKey string, defaultValue float32) (float32, error) ResolveObjectValue(flagKey string, defaultValue map[string]interface{}) (map[string]interface{}, error) }
IEvaluator implementations store the state of the flags, do parsing and validation of the flag state and evaluate flags in response to handlers.
type JsonEvaluator ¶
type JsonEvaluator struct {
// contains filtered or unexported fields
}
func (*JsonEvaluator) GetState ¶
func (je *JsonEvaluator) GetState() (string, error)
func (*JsonEvaluator) ResolveBooleanValue ¶
func (je *JsonEvaluator) ResolveBooleanValue(flagKey string, defaultValue bool) (bool, error)
func (*JsonEvaluator) ResolveNumberValue ¶
func (je *JsonEvaluator) ResolveNumberValue(flagKey string, defaultValue float32) (float32, error)
func (*JsonEvaluator) ResolveObjectValue ¶
func (je *JsonEvaluator) ResolveObjectValue(flagKey string, defaultValue map[string]interface{}) (map[string]interface{}, error)
func (*JsonEvaluator) ResolveStringValue ¶
func (je *JsonEvaluator) ResolveStringValue(flagKey string, defaultValue string) (string, error)
func (*JsonEvaluator) SetState ¶
func (je *JsonEvaluator) SetState(state string) error
type NumberFlag ¶
type ObjectFlag ¶
Click to show internal directories.
Click to hide internal directories.