yaml

package
v0.0.0-...-2068b95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Colors

type Colors struct {
	KeyColor     *color.Color
	ValueColor   *color.Color
	CommentColor *color.Color
}

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.

func (*Encoder) Encode

func (enc *Encoder) Encode(v interface{}) error

Encode writes the YAML encoding of v to the stream.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL