Documentation ¶
Index ¶
- Constants
- type Parser
- func (l *Parser) AllKeys() []string
- func (l *Parser) Get(key string) interface{}
- func (l *Parser) IsSet(key string) bool
- func (l *Parser) MergeStringMap(cfg map[string]interface{}) error
- func (l *Parser) Set(key string, value interface{})
- func (l *Parser) Sub(key string) (*Parser, error)
- func (l *Parser) ToStringMap() map[string]interface{}
- func (l *Parser) Unmarshal(rawVal interface{}) error
- func (l *Parser) UnmarshalExact(intoCfg interface{}) error
Constants ¶
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
NewParserFromBuffer creates a new Parser by reading the given yaml buffer.
func NewParserFromFile ¶ added in v0.28.0
NewParserFromFile creates a new Parser by reading the given file.
func NewParserFromStringMap ¶ added in v0.28.0
NewParserFromStringMap creates a parser from a map[string]interface{}.
func (*Parser) AllKeys ¶ added in v0.28.0
AllKeys returns all keys holding a value, regardless of where they are set. Nested keys are returned with a KeyDelimiter separator.
func (*Parser) IsSet ¶ added in v0.28.0
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
MergeStringMap merges the configuration from the given map with the existing config. Note that the given map may be modified.
func (*Parser) Sub ¶ added in v0.28.0
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
ToStringMap creates a map[string]interface{} from a Parser.
func (*Parser) Unmarshal ¶ added in v0.28.0
Unmarshal unmarshalls the config into a struct. Tags on the fields of the structure must be properly set.
func (*Parser) UnmarshalExact ¶ added in v0.28.0
UnmarshalExact unmarshalls the config into a struct, erroring if a field is nonexistent.