Documentation ¶
Overview ¶
Package yaml provides a function to extract values from yaml.MapSlice.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapSliceExtractFunc ¶
func MapSliceExtractFunc() func(query.ExtractFunc) query.ExtractFunc
MapSliceExtractFunc is a function for query.CustomExtractFunc option to extract values from yaml.MapSlice.
Example ¶
b := []byte(`- foo: bar`) var v interface{} if err := yaml.UnmarshalWithOptions(b, &v, yaml.UseOrderedMap()); err != nil { log.Fatal(err) } q := query.New( query.CaseInsensitive(), query.CustomExtractFunc(yamlextractor.MapSliceExtractFunc()), ).Index(0).Key("FOO") got, err := q.Extract(v) if err != nil { log.Fatal(err) } fmt.Println(got)
Output: bar
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.