Documentation
¶
Overview ¶
Package dataset merge-loads a directory of YAML data files into one set of top-level sections and decodes each section strictly into a typed value, so a front-end's repository data (tools, paths, checks) can be split across files by topic without a key silently overriding another or a misspelled field being dropped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dataset ¶
type Dataset struct {
// contains filtered or unexported fields
}
Dataset is the merged top-level sections of a directory of YAML files.
func Load ¶
Load reads every *.yaml file directly in dir of fsys, in name order, and merges their top-level keys. A file that does not parse, or a key defined in two files, is CodeInvalidInput naming the file (both files for a duplicate).
func (*Dataset) Decode ¶ added in v0.0.19
Decode decodes every section of d into the matching field of the struct out points to. A section matches the exported field whose yaml tag name equals its key (an untagged field matches its lower-cased name). out must be a non-nil pointer to a struct; a key with no field, or a section that does not fit its field (a field the type does not declare included), is CodeInvalidInput naming the section's file. A field with no section keeps its zero value.