Documentation
¶
Index ¶
- func Get(src any, path string) (any, error)
- func GetBool(data any, path string, defaults ...bool) bool
- func GetBoolStrict(data any, path string) (bool, error)
- func GetFloat64(data any, path string, defaults ...float64) float64
- func GetFloat64Strict(data any, path string) (float64, error)
- func GetInt(data any, path string, defaults ...int) int
- func GetIntStrict(data any, path string) (int, error)
- func GetList(data any, path string, defaults ...[]any) []any
- func GetListStrict(data any, path string) ([]any, error)
- func GetListString(data any, path string, defaults ...[]string) []string
- func GetMap(data any, path string, defaults ...map[string]any) map[string]any
- func GetMapStrict(data any, path string) (map[string]any, error)
- func GetString(data any, path string, defaults ...string) string
- func GetStringStrict(data any, path string) (string, error)
- func SetMap(data any, path string, key string, value any) error
- func ToListString(in []any) []string
- type YAML
- func (y *YAML) Bool(path string, defaults ...bool) bool
- func (y *YAML) Data() any
- func (y *YAML) Float64(path string, defaults ...float64) float64
- func (y *YAML) Get(path string) (*YAML, error)
- func (y *YAML) Int(path string, defaults ...int) int
- func (y *YAML) List(path string, defaults ...[]any) []any
- func (y *YAML) ListString(path string, defaults ...[]string) []string
- func (y *YAML) Map(path string, defaults ...map[string]any) map[string]any
- func (y *YAML) String(path string, defaults ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns a child of the given value according to a dotted path. The source data must be either map[string]any or []any
func GetBoolStrict ¶
GetBoolStrict returns a bool according to a dotted path.
func GetFloat64 ¶
GetFloat64 returns a float64 according to a dotted path or default value or 0.
func GetFloat64Strict ¶
GetFloat64Strict returns a float64 according to a dotted path.
func GetIntStrict ¶
GetIntStrict returns an int according to a dotted path.
func GetListStrict ¶
GetListStrict returns a []any according to a dotted path.
func GetListString ¶
GetListString is for the very common case of a list of strings
func GetMap ¶
GetMap returns a map[string]any according to a dotted path or default or map[string]any.
func GetMapStrict ¶
GetMapStrict returns a map[string]any according to a dotted path.
func GetStringStrict ¶
GetStringStrict returns a string according to a dotted path.
func ToListString ¶
Types ¶
type YAML ¶
type YAML struct {
// contains filtered or unexported fields
}
YAML represents a complex internal YAML structure with convenient access methods, using dotted path syntax
func ParseJsonFile ¶
ParseJsonFile reads a JSON configuration from the given filename.
func ParseYamlBytes ¶
ParseYamlBytes reads a YAML configuration from the given []byte.
func ParseYamlFile ¶
ParseYamlFile reads a YAML configuration from the given filename.
func (*YAML) ListString ¶
ListString is for the very common case of a list of strings