Documentation ¶
Index ¶
- Constants
- Variables
- func FromFile(filename string, dst interface{}, opts ...Opts) error
- func FromReader(r io.Reader, dst interface{}, format Format) error
- func LoadJson(r io.Reader, dst interface{}) error
- func LoadToml(r io.Reader, dst interface{}) error
- func LoadYaml(r io.Reader, dst interface{}) error
- type Format
- type Loader
- type LoaderFunc
- type Opts
Constants ¶
View Source
const JsonFormat = Format("json")
View Source
const TomlFormat = Format("toml")
View Source
const (
UnknownFormat = Format("")
)
View Source
const YamlFormat = Format("yaml")
Variables ¶
View Source
var DefaultLoader = Loader{ Loaders: map[Format]LoaderFunc{ TomlFormat: LoadToml, JsonFormat: LoadJson, YamlFormat: LoadYaml, }, ExtToFormat: map[string]Format{ ".toml": TomlFormat, ".tml": TomlFormat, ".json": JsonFormat, ".yaml": YamlFormat, ".yml": YamlFormat, }, }
Functions ¶
func FromReader ¶
load data to dst struct from f according to format with default loader
Types ¶
type Loader ¶
type Loader struct { ExtToFormat map[string]Format Loaders map[Format]LoaderFunc }
type LoaderFunc ¶
Click to show internal directories.
Click to hide internal directories.