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 ¶
- func Encode(v cue.Value) ([]byte, error)
- func EncodeStream(iter cue.Iterator) ([]byte, error)
- func Extract(filename string, src interface{}) (*ast.File, error)
- func Validate(b []byte, v cue.Value) error
Functions ¶
func Encode ¶
Encode returns the YAML encoding of v.
func EncodeStream ¶
EncodeStream returns the YAML encoding of iter, where consecutive values of iter are separated with a `---`.
func Extract ¶
Extract parses the YAML specified by src to a CUE expression. If there's more than one document, the documents will be returned as a list. The src argument may be a nil, string, []byte, or io.Reader. If src is nil, the result of reading the file specified by filename will be used.
func Validate ¶
Validate validates the YAML and confirms it matches the constraints specified by v. For YAML streams, all values must match v.
Source Files ¶
yaml.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 8 hours ago –
Tools for package owners.