yamler

package module
v0.4.182 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: ISC Imports: 6 Imported by: 0

Documentation

Overview

Package yamler provides a yaml unmarshaler to object with visited-field tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUnmarshaler added in v0.4.113

func NewUnmarshaler[T any](y *T) (unmarshaler yamlo.GenericYaml)

NewUnmarshaler returns an object that can unmarshal yaml for unimported types

Types

type Unmarshaler added in v0.4.113

type Unmarshaler[T any] struct {
	// contains filtered or unexported fields
}

Unmarshaler is an object that can unmarshal yaml for unimported types

func (*Unmarshaler[T]) Unmarshal added in v0.4.113

func (u *Unmarshaler[T]) Unmarshal(yamlText []byte, yamlDictionaryKey string) (hasData bool, err error)

Unmarshal updates yamlo.Unmarshaler’s value pointer with data from yaml

  • yamlText is utf8-encoded binary data read from the yaml file
  • yamlDictionaryKey is the name of the top-level dictionary-key typically “options”
  • hasData indicates that unmarshal succeeded and yamlDictionaryKey had value

func (*Unmarshaler[T]) VisitedReferencesMap added in v0.4.113

func (u *Unmarshaler[T]) VisitedReferencesMap(yamlText []byte, yamlDictionaryKey string) (yamlVisistedReferences map[any]string, err error)

VisitedReferencesMap returns a map of key: any-typed pointers to fields of u.y, value: lower-case field names - unmarshals yaml again to an any object and then builds the visited references map by comparing the unmarshaled object to the u.y struct-pointer

func (*Unmarshaler[T]) YDump added in v0.4.113

func (u *Unmarshaler[T]) YDump() (yamlVPrint string)

YDump returns field names and values for the yaml value struct

Jump to

Keyboard shortcuts

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