config2

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	YAMLNullTag      = "!!null"
	YAMLBoolTag      = "!!bool"
	YAMLStrTag       = "!!str"
	YAMLIntTag       = "!!int"
	YAMLFloatTag     = "!!float"
	YAMLTimestampTag = "!!timestamp"
	YAMLSeqTag       = "!!seq"
	YAMLMapTag       = "!!map"
	YAMLBinaryTag    = "!!binary"
	YAMLMergeTag     = "!!merge"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Type  EntryType
	Value any
}

func NewEntry

func NewEntry(typ EntryType, value any) Entry

func NewEntryWithHandler

func NewEntryWithHandler(typ EntryType, handler EntryHandler) (Entry, error)

func (*Entry) Handle

func (e *Entry) Handle(handler EntryHandler) error

func (Entry) IsNil

func (e Entry) IsNil() bool

type EntryHandler

type EntryHandler interface {
	Handle(zero any) (any, error)
}

func YAMLHandler

func YAMLHandler(value *yaml.Node) EntryHandler

type EntryType

type EntryType interface {
	Zero() any
	Check(value any) error
}

func NewZeroEntryType

func NewZeroEntryType[V any](checker func(value V) error) EntryType

type Map

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

func NewMap

func NewMap() Map

func (*Map) Get

func (m *Map) Get(key string) any

func (*Map) HandleAndSet

func (m *Map) HandleAndSet(key string, typ EntryType, handler EntryHandler) error

func (*Map) Range

func (m *Map) Range(f func(key string, typ EntryType, value any) bool) bool

func (*Map) Remove

func (m *Map) Remove(key string)

func (*Map) Set

func (m *Map) Set(key string, typ EntryType, value any)

func (*Map) SetEntry

func (m *Map) SetEntry(ket string, entry Entry)

type YAMLMapHandler

type YAMLMapHandler func(key string, value *yaml.Node) error

func (YAMLMapHandler) UnmarshalYAML

func (h YAMLMapHandler) UnmarshalYAML(value *yaml.Node) error

type ZeroEntryType

type ZeroEntryType[V any] struct {
	Checker func(value V) error
}

func (ZeroEntryType[V]) Check

func (t ZeroEntryType[V]) Check(value any) error

func (ZeroEntryType[V]) Zero

func (t ZeroEntryType[V]) Zero() any

Jump to

Keyboard shortcuts

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