go: cuelang.org/go/encoding/yaml Index | Files

package yaml

import "cuelang.org/go/encoding/yaml"

Package yaml converts YAML encodings to and from CUE. When converting to CUE, comments and position information are retained.

Index

Package Files

yaml.go

func Decode Uses

func Decode(r *cue.Runtime, filename string, src interface{}) (*cue.Instance, error)

Decode converts a YAML file to a CUE value. Streams are returned as a list of the streamed values.

func Encode Uses

func Encode(v cue.Value) ([]byte, error)

Encode returns the YAML encoding of v.

func EncodeStream Uses

func EncodeStream(iter cue.Iterator) ([]byte, error)

EncodeStream returns the YAML encoding of iter, where consecutive values of iter are separated with a `---`.

func Extract Uses

func Extract(filename string, src interface{}) (*ast.File, error)

Extract parses the YAML to a CUE expression. Streams are returned as a list of the streamed values.

func Validate Uses

func Validate(b []byte, v cue.Value) error

Validate validates the YAML and confirms it matches the constraints specified by v. For YAML streams, all values must match v.

Package yaml imports 7 packages (graph) and is imported by 1 packages. Updated 2019-11-18. Refresh now. Tools for package owners.