Documentation
¶
Overview ¶
Package yamlutils provides utilities to work with YAML documents.
Index ¶
Constants ¶
const (
// ErrYAML is an error raised by YAML utilities
ErrYAML yamlError = "yaml error"
)
Variables ¶
This section is empty.
Functions ¶
func BytesToYAMLDoc ¶
BytesToYAMLDoc converts a byte slice into a YAML document.
This function only supports root documents that are objects.
A YAML document is a pointer to a yaml.Node.
func YAMLToJSON ¶
func YAMLToJSON(value interface{}) (json.RawMessage, error)
YAMLToJSON converts a YAML document into JSON bytes.
Note: a YAML document is the output from a yaml.Marshaler, e.g a pointer to a yaml.Node.
Types ¶
type YAMLMapItem ¶
type YAMLMapItem = jsonutils.JSONMapItem
YAMLMapItem represents the value of a key in a YAML object held by YAMLMapSlice.
It is entirely equivalent to jsonutils.JSONMapItem, with the same limitation that you should not Marshal or Unmarshal directly this type, outside of a YAMLMapSlice.
type YAMLMapSlice ¶
type YAMLMapSlice []YAMLMapItem
YAMLMapSlice represents a YAML object, with the order of keys maintained.
It is similar to jsonutils.JSONMapSlice and also knows how to marshal and unmarshal YAML.
func (YAMLMapSlice) MarshalJSON ¶
func (s YAMLMapSlice) MarshalJSON() ([]byte, error)
MarshalJSON renders this YAML object as JSON bytes.
func (YAMLMapSlice) MarshalYAML ¶
func (s YAMLMapSlice) MarshalYAML() (interface{}, error)
MarshalYAML produces a YAML document as bytes
func (*YAMLMapSlice) UnmarshalJSON ¶
func (s *YAMLMapSlice) UnmarshalJSON(data []byte) error
UnmarshalJSON builds this YAML object from JSON bytes.