configparser

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyDelimiter is used as the default key delimiter in the default koanf instance.
	KeyDelimiter = "::"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMap added in v0.35.0

type ConfigMap struct {
	// contains filtered or unexported fields
}

ConfigMap loads configuration.

func NewConfigMap added in v0.36.0

func NewConfigMap() *ConfigMap

NewConfigMap creates a new empty ConfigMap instance.

func NewConfigMapFromBuffer added in v0.36.0

func NewConfigMapFromBuffer(buf io.Reader) (*ConfigMap, error)

NewConfigMapFromBuffer creates a new ConfigMap by reading the given yaml buffer.

func NewConfigMapFromFile added in v0.36.0

func NewConfigMapFromFile(fileName string) (*ConfigMap, error)

NewConfigMapFromFile creates a new ConfigMap by reading the given file.

func NewConfigMapFromStringMap added in v0.36.0

func NewConfigMapFromStringMap(data map[string]interface{}) *ConfigMap

NewConfigMapFromStringMap creates a ConfigMap from a map[string]interface{}.

func (*ConfigMap) AllKeys added in v0.35.0

func (l *ConfigMap) AllKeys() []string

AllKeys returns all keys holding a value, regardless of where they are set. Nested keys are returned with a KeyDelimiter separator.

func (*ConfigMap) Get added in v0.35.0

func (l *ConfigMap) Get(key string) interface{}

Get can retrieve any value given the key to use.

func (*ConfigMap) IsSet added in v0.35.0

func (l *ConfigMap) IsSet(key string) bool

IsSet checks to see if the key has been set in any of the data locations. IsSet is case-insensitive for a key.

func (*ConfigMap) MergeStringMap added in v0.35.0

func (l *ConfigMap) MergeStringMap(cfg map[string]interface{}) error

MergeStringMap merges the configuration from the given map with the existing config. Note that the given map may be modified.

func (*ConfigMap) Set added in v0.35.0

func (l *ConfigMap) Set(key string, value interface{})

Set sets the value for the key.

func (*ConfigMap) Sub added in v0.35.0

func (l *ConfigMap) Sub(key string) (*ConfigMap, error)

Sub returns new Parser instance representing a sub-config of this instance. It returns an error is the sub-config is not a map (use Get()) and an empty Parser if none exists.

func (*ConfigMap) ToStringMap added in v0.35.0

func (l *ConfigMap) ToStringMap() map[string]interface{}

ToStringMap creates a map[string]interface{} from a Parser.

func (*ConfigMap) Unmarshal added in v0.35.0

func (l *ConfigMap) Unmarshal(rawVal interface{}) error

Unmarshal unmarshalls the config into a struct. Tags on the fields of the structure must be properly set.

func (*ConfigMap) UnmarshalExact added in v0.35.0

func (l *ConfigMap) UnmarshalExact(intoCfg interface{}) error

UnmarshalExact unmarshalls the config into a struct, erroring if a field is nonexistent.

Jump to

Keyboard shortcuts

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