yamlkeys

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This Go library allows for decoding arbitrary YAML content that includes maps with complex keys into basic Go data types (strings, ints, floats, bools, maps, and slices).

For more information, see the project page:

https://github.com/tliron/yamlkeys

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(value any) any

func Decode

func Decode(reader io.Reader) (any, error)

func DecodeAll

func DecodeAll(reader io.Reader) ([]any, error)

func DecodeKeyNode

func DecodeKeyNode(node ast.Node) (any, any, error)

func DecodeNode

func DecodeNode(node ast.Node) (any, error)

func DecodeString

func DecodeString(s string) (any, error)

func DecodeStringAll

func DecodeStringAll(s string) ([]any, error)

func Equals

func Equals(a any, b any) bool

func IsSimpleKey

func IsSimpleKey(data any) bool

func KeyData

func KeyData(data any) any

func KeyString

func KeyString(data any) string

func MapDelete

func MapDelete(map_ Map, key any) (any, bool)

func MapGet

func MapGet(map_ Map, key any) (any, bool)

func MapMerge

func MapMerge(to Map, from Map, override bool)

func MapPut

func MapPut(map_ Map, key any, value any) (any, bool)

func WrapWithDecodeError

func WrapWithDecodeError(err error) error

Types

type DecodeError

type DecodeError struct {
	Message string
	Line    int
	Column  int
}

func NewDecodeError

func NewDecodeError(message string, line int, column int) *DecodeError

func NewDecodeErrorFor

func NewDecodeErrorFor(message string, node ast.Node) *DecodeError

func NewDuplicateKeyErrorFor

func NewDuplicateKeyErrorFor(key any, node ast.Node) *DecodeError

func (*DecodeError) Error

func (self *DecodeError) Error() string

(error interface)

type Key

type Key interface {
	GetKeyData() any
}

type Map

type Map = map[any]any

type Sequence

type Sequence = []any

type YAMLKey

type YAMLKey struct {
	Data any
	Text string
}

func NewYAMLKey

func NewYAMLKey(data any) (*YAMLKey, error)

func (*YAMLKey) GetKeyData

func (self *YAMLKey) GetKeyData() any

Key interface

func (*YAMLKey) MarshalYAML

func (self *YAMLKey) MarshalYAML() (any, error)

yaml.Marshaler interface

func (*YAMLKey) String

func (self *YAMLKey) String() string

fmt.Stringify interface

Jump to

Keyboard shortcuts

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