configparser

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 11 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 Parser added in v0.28.0

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

Parser loads configuration.

func NewParser added in v0.28.0

func NewParser() *Parser

NewParser creates a new empty Parser instance.

func NewParserFromBuffer added in v0.28.0

func NewParserFromBuffer(buf io.Reader) (*Parser, error)

NewParserFromBuffer creates a new Parser by reading the given yaml buffer.

func NewParserFromFile added in v0.28.0

func NewParserFromFile(fileName string) (*Parser, error)

NewParserFromFile creates a new Parser by reading the given file.

func NewParserFromStringMap added in v0.28.0

func NewParserFromStringMap(data map[string]interface{}) *Parser

NewParserFromStringMap creates a parser from a map[string]interface{}.

func (*Parser) AllKeys added in v0.28.0

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

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

func (*Parser) Get added in v0.28.0

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

Get can retrieve any value given the key to use.

func (*Parser) IsSet added in v0.28.0

func (l *Parser) 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 (*Parser) MergeStringMap added in v0.28.0

func (l *Parser) 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 (*Parser) Set added in v0.28.0

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

Set sets the value for the key.

func (*Parser) Sub added in v0.28.0

func (l *Parser) Sub(key string) (*Parser, 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 (*Parser) ToStringMap added in v0.28.0

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

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

func (*Parser) Unmarshal added in v0.28.0

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

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

func (*Parser) UnmarshalExact added in v0.28.0

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

UnmarshalExact unmarshals 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