Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Colors ¶
Colors is a structure passed to NewEncoder for specifying the colors used for printing keys, values and comments in the resulting YAML.
type Encoder ¶
type Encoder struct { Colors *Colors // contains filtered or unexported fields }
An Encoder writes values as YAML to an output stream.
func NewEncoder ¶
func NewEncoder(w io.Writer, options ...EncoderOption) *Encoder
NewEncoder returns a new YAML encoder that writes to w.
type EncoderOption ¶
type EncoderOption func(*Encoder)
EncoderOption represents an option for creating a new encoder.
func EncoderColors ¶
func EncoderColors(c *Colors) EncoderOption
EncoderColors sets the colors for highlighting keys, values and comments.
func EncoderDateKeys ¶
func EncoderDateKeys(g []glob.Glob) EncoderOption
EncoderDateKeys sets a list of globs that define the keys whose values should be encoded as a date. Every key that matches any of the globs and have a numeric value are encoded as a date, which means that a comment is added with the human-friendly date.
func EncoderIndent ¶
func EncoderIndent(i int) EncoderOption
EncoderIndent sets the indentation size used while encoding the YAML.