Documentation ¶
Index ¶
- func FindPotentialVariables(text []byte) []string
- func Interpolate(i interface{}, values map[string]string) error
- func ParseOrderedMap(ms yaml.MapSlice, assign func(string, []byte) error) ([]string, error)
- func UnmarshalOneOf(candidates ...UnmarshalCandidate) error
- type NullableStringList
- type StringList
- type UnmarshalCandidate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPotentialVariables ¶
FindPotentialVariables returns a list of potential interpolation target names.
func Interpolate ¶
Interpolate an arbitrary YAML-marshallable interface.
func ParseOrderedMap ¶
ParseOrderedMap returns a list of keys in order and performs map assignment. The assign function passed allows a closure to handle the map assignment in a type-safe manner using the keyname and raw text ready to be unmarshaled.
func UnmarshalOneOf ¶
func UnmarshalOneOf(candidates ...UnmarshalCandidate) error
UnmarshalOneOf unmarshals candidates of different types until successful. If any error other than a yaml.TypeError is thrown, that error is returned immediately. If no candidates are valid, the error from the last candidate passed will be returned.
Types ¶
type NullableStringList ¶
type NullableStringList []*string
NullableStringList is a list of nullable strings optionally represented in yaml as a string. A single string in yaml will be unmarshaled as the first entry in a list, so the internal representation is always a list. Due to a quirk of the yaml-parsing library, a single null item will be interpretted as a null list rather than a list containing a single null item.
func (*NullableStringList) UnmarshalYAML ¶
func (sl *NullableStringList) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a nullable string or list of nullable strings always into a list.
type StringList ¶
type StringList []string
StringList is a list of strings optionally represented in yaml as a string. A single string in yaml will be unmarshaled as the first entry in a list, so the internal representation is always a list.
func (*StringList) UnmarshalYAML ¶
func (sl *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a string or list of strings always into a list.
type UnmarshalCandidate ¶
type UnmarshalCandidate struct { // Unmarshal should return the result of UnmarshalYAML's unmarshal function. // This simply provides a closure so that different data types can be // safely passed into the unmarshaling function without reflection. Unmarshal func() error // Assign assigns the newly unmarshaled item using a closure. // This allows the resulting value from an unmarshaling to be assigned // to the receiver of the custom UnmarshalYAML function. Assign func() // Validate is an optional function that can validate after unmarshaling. // Assignment will not occur if validation fails. Validate func() error }
UnmarshalCandidate is a candidate for unmarshaling. Candidates should only be defined inside of an UnmarshalYAML function.