yaml

package
v0.10.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

README

YAML reader for CUE

This yaml parser is a heavily modified version of Canonical's go-yaml parser, which in turn is a port of the libyaml parser.

License

The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details.

Documentation

Overview

Package yaml implements YAML support for the Go language.

Source code and other details for the project are available at GitHub:

https://github.com/go-yaml/yaml

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(filename string, in []byte) (expr ast.Expr, err error)

Unmarshal decodes the first document found within the in byte slice and returns it as a CUE syntax AST.

Types

type Decoder

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

A Decoder reads and decodes YAML values from an input stream.

func NewDecoder

func NewDecoder(filename string, src interface{}) (*Decoder, error)

NewDecoder returns a new decoder that reads from r.

The decoder introduces its own buffering and may read data from r beyond the YAML values requested.

func (*Decoder) Decode

func (dec *Decoder) Decode() (expr ast.Expr, err error)

Decode reads the next YAML-encoded value from its input and returns it as CUE syntax. It returns io.EOF if there are no more value in the stream.

type TypeError

type TypeError struct {
	Errors []string
}

A TypeError is returned by Unmarshal when one or more fields in the YAML document cannot be properly decoded into the requested types. When this error is returned, the value is still unmarshaled partially.

func (*TypeError) Error

func (e *TypeError) Error() string

Jump to

Keyboard shortcuts

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