Debian Codegraph @

interfaces.go

raw
1 package koanf
2
3 // Provider represents a configuration provider. Providers can
4 // read configuration from a source (file, HTTP etc.)
5 type Provider interface {
6 // ReadBytes returns the entire configuration as raw []bytes to be parsed.
7 // with a Parser.
8 ReadBytes() ([]byte, error)
9
10 // Read returns the parsed configuration as a nested map[string]any.
11 // It is important to note that the string keys should not be flat delimited
12 // keys like `parent.child.key`, but nested like `{parent: {child: {key: 1}}}`.
13 Read() (map[string]any, error)
14 }
15
16 // Parser represents a configuration format parser.
17 type Parser interface {
18 Unmarshal([]byte) (map[string]any, error)
19 Marshal(map[string]any) ([]byte, error)
20 }