preprocessor

package
v0.0.0-...-707cffb Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMatrixNeedsCollection = errors.New("matrix should contain a collection")

ErrMatrixNeedsCollection is returned when the matrix modifier does not contain a collection (either map or slice) inside.

View Source
var ErrMatrixNeedsListOfMaps = errors.New("matrix with a list can only contain maps as it's items")

ErrMatrixNeedsListOfMaps is returned when the matrix modifier contains something other than maps (e.g. lists or scalars) as it's items.

View Source
var ErrNeedMap = errors.New("first document should be a map")

ErrNeedMap is returned when the input document passed to preprocessor does not contain a map as it's "outer" layer.

Functions

This section is empty.

Types

type Preprocessor

type Preprocessor struct {
	// contains filtered or unexported fields
}

A Preprocessor for YAML files with matrix modifiers.

func New

func New(in []byte) (*Preprocessor, error)

New constructs preprocessor by loading the first YAML document from the supplied byte slice.

func NewFromFile

func NewFromFile(path string) (*Preprocessor, error)

NewFromFile constructs preprocessor by loading the first YAML document from the file located at path.

func (*Preprocessor) Dump

func (p *Preprocessor) Dump() ([]byte, error)

Dump marshals the loaded (and possibly preprocessed) YAML document back.

func (*Preprocessor) Run

func (p *Preprocessor) Run() error

Run preprocesses matrix modifiers in the loaded YAML document.

Jump to

Keyboard shortcuts

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