config

package
v0.0.0-...-35f88bb Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(input interface{}, output interface{}) error

Decode decodes generic map values from `input` to `output`, while providing helpful error information. `output` must be a pointer to a Go struct that contains `mapstructure` struct tags on fields that should be decoded. This function is useful when decoding values from configuration files parsed as `map[string]interface{}` or component metadata as `map[string]string`.

Most of the heavy lifting is handled by the mapstructure library. A custom decoder is used to handle decoding string values to the supported primitives.

func Normalize

func Normalize(i interface{}) (interface{}, error)

Normalize converts map[interface{}]interface{} to map[string]interface{} to normalize for JSON and usage in component initialization.

func PrefixedBy

func PrefixedBy(input interface{}, prefix string) (interface{}, error)

Types

type StringDecoder

type StringDecoder interface {
	DecodeString(value string) error
}

StringDecoder is used as a way for custom types (or alias types) to override the basic decoding function in the `decodeString` DecodeHook. `encoding.TextMashaller` was not used because it matches many Go types and would have potentially unexpected results. Specifying a custom decoding func should be very intentional.

Jump to

Keyboard shortcuts

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