yamlutil

package
v0.0.0-...-60c5125 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToYAMLEncodeObject = errors.New("failed to YAML encode object")
	ErrFailedToCloseYAMLEncoder = errors.New("failed to close YAML encoder")
	ErrFailedToOpenYAMLFile     = errors.New("failed to open YAML file")
)

Functions

This section is empty.

Types

type Document

type Document string

func BuildDocument

func BuildDocument(object any) (yd Document, err error)

type DocumentBuilder

type DocumentBuilder interface {
	BuildYAMLDocument() (Document, error)
}

type Documentizer

type Documentizer interface {
	YAMLDocument() Document
}

type EntriesIterator

type EntriesIterator struct {
	iter.Seq2[FilterableEntry, error]
	Err error
}

type EntryFilterFunc

type EntryFilterFunc func(FilterableEntry) bool

type FilterableEntry

type FilterableEntry interface {
	FilterableEntry()
}

type GetDocFromEntryFunc

type GetDocFromEntryFunc func(FilterableEntry, EntryFilterFunc) (Document, error)

type MultidocFile

type MultidocFile interface {
	fmt.Stringer
	Documents() []Document
	AddDocument(Document)
}

func BuildMultidocFile

func BuildMultidocFile(entryIterator EntriesIterator, filter EntryFilterFunc, getDocFromEntry GetDocFromEntryFunc) (yf MultidocFile, err error)

func NewFile

func NewFile() MultidocFile

func NewMultidocFile

func NewMultidocFile() MultidocFile

type MultidocFileBuilder

type MultidocFileBuilder interface {
	BuildYAMLFile() (MultidocFile, error)
}

type MultidocFileizer

type MultidocFileizer interface {
	YAMLFile() MultidocFile
}

type Value

type Value struct {
	Value any
}

func NewValue

func NewValue(value any) *Value

func UnmarshalYAMLNode

func UnmarshalYAMLNode(value *yaml.Node) (v *Value, err error)

UnmarshalYAMLNode unmarshalls a yaml.Node based on its Tag field

func (*Value) Float64

func (v *Value) Float64() (f float64)

func (*Value) Kind

func (v *Value) Kind() (rk reflect.Kind, err error)

Kind returns reflect.Kind corresponding to the value of .Value field

func (*Value) LogArgs

func (v *Value) LogArgs() []any

LogArgs returns array of log args for the Value

func (*Value) MarshalYAML

func (v *Value) MarshalYAML() (out any, err error)

MarshalYAML allows Value to contain one string or a slice of string

func (*Value) String

func (v *Value) String() (s string)

func (*Value) Type

func (v *Value) Type() (s string)

func (*Value) UnmarshalYAML

func (v *Value) UnmarshalYAML(value *yaml.Node) (err error)

UnmarshalYAML unmarshalls a Value

Jump to

Keyboard shortcuts

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