Documentation ¶
Index ¶
- type Config
- type Selector
- func (v *Selector) Evaluate(data map[string]interface{}) (string, error)
- func (v *Selector) EvaluateBool(data map[string]interface{}) (bool, error)
- func (v *Selector) EvaluateFloat64(data map[string]interface{}) (float64, error)
- func (v *Selector) EvaluateInt64(data map[string]interface{}) (int64, error)
- func (v *Selector) EvaluateUint8(data map[string]interface{}) (uint8, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config used to ease getting values from config using dot notation (obj.Selector.array[0].Selector), and used to resolve dynamic values.
func (*Config) NewSelector ¶
NewSelector Returns a new Selector used to evaluate dynamic fields in a config (this receiver was made for easing refactoring)
func (*Config) Populate ¶
Populate will populate 'dst' struct with the config field in the YAML configuration, structs can use two tags, `mapstructure` to map the config to the struct look up (github.com/mitchellh/mapstructure) docsfor more about its tags, and `validate` tag for quick validation lookup (gopkg.in/go-playground/validator.v9) validate tags for more about its tags.
type Selector ¶
type Selector struct {
// contains filtered or unexported fields
}
Selector Contains a base in the config, this base can be static or dynamic, dynamic values must be get using Evaluate()
func NewSelector ¶
NewSelector Returns a new Selector used to evaluate dynamic fields in a config
func (*Selector) Evaluate ¶
Evaluate Evaluate dynamic values of config such as `image-@{image.title}.jpg` as a string, return error if it doesn't exist in supplied Data. TODO differentiate between not found in data, and being evaluated to 0 in a better way.
func (*Selector) EvaluateBool ¶
EvaluateBool Evaluate dynamic values of config such as `@{image.doFlip}` as bool, return error if it doesn't exist in supplied Data. values such as 0,1,T,F,True,False are all possible values,if base evaluated value is "" it returns zero value of Float64 = 0.0
func (*Selector) EvaluateFloat64 ¶
EvaluateFloat64 Evaluate dynamic values of config such as `@{image.width}` as float64, return error if it doesn't exist in supplied Data. if base evaluated value is "" it returns zero value of Float64 = 0.0
func (*Selector) EvaluateInt64 ¶
EvaluateInt64 Evaluate dynamic values of config such as `@{image.width}` as Int64, return error if it doesn't exist in supplied Data. if base evaluated value is "" it returns zero value of Int64 = 0
func (*Selector) EvaluateUint8 ¶
EvaluateUint8 Evaluate dynamic values of config such as `@{image.width}` as uint8, return error if it doesn't exist in supplied Data. if base evaluated value is "" it returns zero value of Uint8 = 0