Documentation
¶
Index ¶
- Constants
- Variables
- func SetLogger(logger Logger)
- func Variables(expression string) ([]string, error)
- type Configuration
- type Configurations
- type DataProvider
- type Evaluation
- func (v Evaluation) Bool(defaultValue bool) bool
- func (v Evaluation) Int(defaultValue int) int
- func (v Evaluation) IsNone() bool
- func (v Evaluation) Map(defaultValue map[string]interface{}) map[string]interface{}
- func (v Evaluation) Number(defaultValue float64) float64
- func (v Evaluation) String(defaultValue string) string
- type Evaluations
- type Evaluator
- type Logger
- type Prerequisite
- type RolloutItem
- type Rule
- type Target
- type Variable
Constants ¶
View Source
const ( CreateFlagEvent = "create_flag" PatchFlagEvent = "patch_flag" DeleteFlagEvent = "delete_flag" CreateVariable = "create_var" PatchVariable = "patch_var" DeleteVariable = "delete_var" )
Variables ¶
View Source
var ( // ErrQueryProviderMissing ... ErrQueryProviderMissing = errors.New("query field is missing in evaluator") )
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct {
Project string `json:"project"`
Environment string `json:"environment"`
Identifier string `json:"identifier"`
Deprecated bool `json:"deprecated"`
On bool `json:"on"`
OnValue interface{} `json:"on_value"`
OffValue interface{} `json:"off_value"`
Rules []Rule `json:"rules"`
Prerequisites []Prerequisite `json:"prerequisites"`
Version uint `json:"version"`
} // @name Configuration
type Configurations ¶
type Configurations []Configuration // @name Configurations
type DataProvider ¶
type DataProvider interface {
GetVariable(key string) (Variable, error)
GetConfiguration(key string) (Configuration, error)
}
DataProvider provides methods for segment and flag retrieval
type Evaluation ¶
type Evaluation struct {
Project string `json:"project"`
Environment string `json:"environment"`
Identifier string `json:"identifier"`
Value interface{} `json:"value"`
// contains filtered or unexported fields
} // @name Evaluation
func (Evaluation) Bool ¶
func (v Evaluation) Bool(defaultValue bool) bool
func (Evaluation) Int ¶
func (v Evaluation) Int(defaultValue int) int
func (Evaluation) IsNone ¶
func (v Evaluation) IsNone() bool
func (Evaluation) Map ¶
func (v Evaluation) Map(defaultValue map[string]interface{}) map[string]interface{}
func (Evaluation) Number ¶
func (v Evaluation) Number(defaultValue float64) float64
func (Evaluation) String ¶
func (v Evaluation) String(defaultValue string) string
type Evaluations ¶
type Evaluations []Evaluation // @name Evaluations
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator engine evaluates flag from provided query
func NewEvaluator ¶
func NewEvaluator(provider DataProvider) (*Evaluator, error)
NewEvaluator constructs evaluator with query instance
type Logger ¶
type Logger interface {
Debug(args ...interface{})
Debugf(template string, args ...interface{})
Info(args ...interface{})
Infof(template string, args ...interface{})
Warn(args ...interface{})
Warnf(template string, args ...interface{})
Error(args ...interface{})
Errorf(template string, args ...interface{})
Panic(args ...interface{})
Panicf(template string, args ...interface{})
Fatal(args ...interface{})
Fatalf(template string, args ...interface{})
}
type Prerequisite ¶
type Prerequisite struct {
Identifier string `json:"identifier" validate:"required"`
Value interface{} `json:"value" validate:"required"`
} // @name Prerequisite
type RolloutItem ¶ added in v0.2.0
type RolloutItem struct {
Value interface{} `json:"__value__"`
Weight int `json:"__weight__"`
} // @name RolloutItem
type Rule ¶
type Rule struct {
Expression string `json:"expression"`
Value interface{} `json:"value"`
} // @name Rule
Click to show internal directories.
Click to hide internal directories.