Documentation ¶
Index ¶
- func GetNestedParam(keyStr, separator string, candidates ...Params) (any, error)
- func PrepareParams(m Params)
- func ToSliceStringMap(in any) ([]map[string]any, error)
- func ToStringMap(in any) map[string]any
- func ToStringMapBool(in any) map[string]bool
- func ToStringMapE(in any) (map[string]any, error)
- func ToStringMapString(in any) map[string]string
- func ToStringMapStringE(in any) (map[string]string, error)
- type Params
- type ParamsMergeStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNestedParam ¶
GetNestedParam gets the first match of the keyStr in the candidates given. It will first try the exact match and then try to find it as a nested map value, using the given separator, e.g. "mymap.name". It assumes that all the maps given have lower cased keys.
func PrepareParams ¶
func PrepareParams(m Params)
PrepareParams * makes all the keys in the given map lower cased and will do so * This will modify the map given. * Any nested map[interface{}]interface{}, map[string]interface{},map[string]string will be converted to Params. * Any _merge value will be converted to proper type and value.
func ToSliceStringMap ¶
ToSliceStringMap converts in to []map[string]interface{}.
func ToStringMap ¶
ToStringMap converts in to map[string]interface{}.
func ToStringMapBool ¶
ToStringMapBool converts in to bool.
func ToStringMapE ¶
ToStringMapE converts in to map[string]interface{}.
func ToStringMapString ¶
ToStringMapString converts in to map[string]string.
Types ¶
type Params ¶
Params is a map where all keys are lower case.
func MustToParamsAndPrepare ¶
MustToParamsAndPrepare calls ToParamsAndPrepare and panics if it fails.
func ToParamsAndPrepare ¶
ToParamsAndPrepare converts in to Params and prepares it for use. If in is nil, an empty map is returned. See PrepareParams.
type ParamsMergeStrategy ¶
type ParamsMergeStrategy string
ParamsMergeStrategy tells what strategy to use in Params.Merge.
const ( // ParamsMergeStrategyNone Do not merge. ParamsMergeStrategyNone ParamsMergeStrategy = "none" // ParamsMergeStrategyShallow Only add new keys. ParamsMergeStrategyShallow ParamsMergeStrategy = "shallow" // ParamsMergeStrategyDeep Add new keys, merge existing. ParamsMergeStrategyDeep ParamsMergeStrategy = "deep" )