yml

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package yml defines tools for parsing and encoding CPT sources written in YAML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(pv *model.ParsedValue, opts ...EncodeOption) string

Encode serializes a model.ParsedValue to a string according to an optional set of encoding options.

The ParsedValue does not necessarily need to be well-formed in order to be encoded.

func Parse

func Parse(src *model.Source) (*model.ParsedValue, *cel.Issues)

Parse decodes a YAML source object to a model.ParsedValue.

The decoding step relies on the use of YAML tags to determine the type of each element. Specially, the tags used must align with the ones produced by the Go YAML v3 library.

Errors in the decoding will result in a nil model.ParsedValue.

func RenderDebugIDs

func RenderDebugIDs(enc *encoder) *encoder

RenderDebugIDs modifies the encoding to print out source element ids into the encoded string.

Types

type EncodeOption

type EncodeOption func(*encoder) *encoder

EncodeOption describes a functional argument for configuring the behavior of the encoder.

Jump to

Keyboard shortcuts

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