marshaller

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PopulateModel

func PopulateModel(source any, target any) error

func SyncValue

func SyncValue(ctx context.Context, source any, target any, valueNode *yaml.Node) (node *yaml.Node, err error)

func Unmarshal

func Unmarshal(ctx context.Context, node *yaml.Node, out any) error

func UnmarshalStruct

func UnmarshalStruct(ctx context.Context, node *yaml.Node, structPtr any) error

Types

type ExtensionCoreMap

type ExtensionCoreMap interface {
	Get(string) (Node[extensions.Extension], bool)
	Set(string, Node[extensions.Extension])
	Delete(string)
	All() iter.Seq2[string, Node[extensions.Extension]]
	Init()
}

type ExtensionMap

type ExtensionMap interface {
	Set(string, extensions.Extension)
	Init()
}

type ExtensionSourceIterator

type ExtensionSourceIterator interface {
	All() iter.Seq2[string, extensions.Extension]
}

type ModelFromCore

type ModelFromCore interface {
	FromCore(c any) error
}

type Node

type Node[V any] struct {
	Key       string
	KeyNode   *yaml.Node
	Value     V
	ValueNode *yaml.Node
	Present   bool
}

func (Node[V]) GetKeyNodeOrRoot

func (n Node[V]) GetKeyNodeOrRoot(rootNode *yaml.Node) *yaml.Node

func (Node[V]) GetMapKeyNodeOrRoot

func (n Node[V]) GetMapKeyNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

Will return the key node for the map key, or the map root node or the provided root node if the node is not present

func (Node[V]) GetMapValueNodeOrRoot

func (n Node[V]) GetMapValueNodeOrRoot(key string, rootNode *yaml.Node) *yaml.Node

Will return the value node for the map key, or the map root node or the provided root node if the node is not present

func (Node[V]) GetNavigableNode

func (n Node[V]) GetNavigableNode() any

func (Node[V]) GetSliceValueNodeOrRoot

func (n Node[V]) GetSliceValueNodeOrRoot(idx int, rootNode *yaml.Node) *yaml.Node

Will return the value node for the slice index, or the slice root node or the provided root node if the node is not present

func (Node[V]) GetValue

func (n Node[V]) GetValue() any

func (Node[V]) GetValueNodeOrRoot

func (n Node[V]) GetValueNodeOrRoot(rootNode *yaml.Node) *yaml.Node

func (Node[V]) GetValueType

func (n Node[V]) GetValueType() reflect.Type

func (*Node[V]) SetPresent

func (n *Node[V]) SetPresent(present bool)

func (*Node[V]) SyncValue

func (n *Node[V]) SyncValue(ctx context.Context, key string, value any) (*yaml.Node, *yaml.Node, error)

func (*Node[V]) Unmarshal

func (n *Node[V]) Unmarshal(ctx context.Context, keyNode, valueNode *yaml.Node) error

type NodeAccessor

type NodeAccessor interface {
	GetValue() any
	GetValueType() reflect.Type
}

type NodeMutator

type NodeMutator interface {
	Unmarshal(ctx context.Context, keyNode, valueNode *yaml.Node) error
	SetPresent(present bool)
	SyncValue(ctx context.Context, key string, value any) (*yaml.Node, *yaml.Node, error)
}

type SequencedMap

type SequencedMap interface {
	Init()
	SetUntyped(key, value any) error
	AllUntyped() iter.Seq2[any, any]
	GetValueType() reflect.Type
}

type Syncer

type Syncer interface {
	SyncChanges(ctx context.Context, model any, valueNode *yaml.Node) (*yaml.Node, error)
}

type SyncerWithSyncFunc

type SyncerWithSyncFunc interface {
	SyncChangesWithSyncFunc(ctx context.Context, model any, valueNode *yaml.Node, syncFunc func(context.Context, any, any, *yaml.Node) (*yaml.Node, error)) (*yaml.Node, error)
}

type Unmarshallable

type Unmarshallable interface {
	Unmarshal(ctx context.Context, value *yaml.Node) error
}

Jump to

Keyboard shortcuts

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