marshaler

package
v0.0.0-...-9edc83d Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedPointer = errors.New("must unmarshal into pointer type or map")
View Source
var ErrStructOrMap = errors.New("can only decode into struct or map")

Functions

func AddCustomMarshaler

func AddCustomMarshaler[T any](marshal func(v reflect.Value, node *document.Node) error)

func AddCustomUnmarshaler

func AddCustomUnmarshaler[T any](unmarshal func(node *document.Node, v reflect.Value) error)

func AddCustomValueMarshaler

func AddCustomValueMarshaler[T any](marshal func(v reflect.Value, value *document.Value, format string) error)

func AddCustomValueUnmarshaler

func AddCustomValueUnmarshaler[T any](unmarshal func(value *document.Value, v reflect.Value, format string) error)

func Debug

func Debug(s string, v ...interface{})

func IsType

func IsType[T any](rv reflect.Value) bool

func Marshal

func Marshal(v interface{}, doc *document.Document) error

func MarshalNode

func MarshalNode(v interface{}) (*document.Node, error)

func MarshalNodeWithOptions

func MarshalNodeWithOptions(v interface{}, opts MarshalOptions) (*document.Node, error)

func MarshalWithOptions

func MarshalWithOptions(v interface{}, doc *document.Document, opts MarshalOptions) error

func TypeAssert

func TypeAssert[T any](rv reflect.Value) (T, bool)

func Unmarshal

func Unmarshal(doc *document.Document, v interface{}) error

func UnmarshalNode

func UnmarshalNode(node *document.Node, v interface{}) error

func UnmarshalNodeWithOptions

func UnmarshalNodeWithOptions(node *document.Node, v interface{}, opts UnmarshalOptions) error

func UnmarshalWithOptions

func UnmarshalWithOptions(doc *document.Document, v interface{}, opts UnmarshalOptions) error

Types

type CustomArshalerFlags

type CustomArshalerFlags uint8

func (CustomArshalerFlags) Has

type MarshalOptions

type MarshalOptions struct {
	CaseSensitive bool
	// BareSuffixed causes suffixed numeric values to be written unquoted to the output file, which is noncompliant with the KDL spec
	BareSuffixed bool
}

type UnmarshalOptions

type UnmarshalOptions struct {
	AllowUnhandledNodes    bool
	AllowUnhandledArgs     bool
	AllowUnhandledProps    bool
	AllowUnhandledChildren bool
	RelaxedNonCompliant    relaxed.Flags
	CaseSensitive          bool
	ParseComments          bool
}

Jump to

Keyboard shortcuts

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