core

package
v3.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package core provides functions to extract values from a set of yaml files after merging them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fill

func Fill(keyPath string, conf interface{}, decoderConfig *mapstructure.DecoderConfig) error

Fill will fill a according to DecoderConfig with the values from conf.

func FillValue

func FillValue(keyPath string, conf interface{}, out interface{}) bool

FillValue will fill a struct, out, with values from conf.

func GetValue

func GetValue(conf interface{}, keyPath string) (interface{}, error)

GetValue returns the value at the indicated path. Paths are separated by the '/' character. The empty string or "/" will return conf itself.

func ListToMap

func ListToMap(l []interface{}) map[interface{}]interface{}

ListToMap converts a list to an integer map.

func MergeValue

func MergeValue(config interface{}, keyPath string, value interface{}, overwrite bool) error

MergeValue will merge the values from value into config at keyPath. If overwrite is true, values from value will overwrite existing values in config.

func SaveConf

func SaveConf(config interface{}, file string) error

SaveConf will save config to file as yaml

func SetValue

func SetValue(config interface{}, keyPath string, value interface{}) error

SetValue will set the value of config at keyPath to value.

func ToKvMap

func ToKvMap(conf interface{}) map[string]string

ToKvMap will return a one-level map of key value pairs where the key is a / separated path of subkeys.

func Walk

func Walk(callback func(key []string, value interface{}), conf interface{})

Walk will recursively iterate over all the nodes of conf calling callback for each node.

Types

This section is empty.

Jump to

Keyboard shortcuts

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