codec

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSON

func DecodeJSON(reader io.Reader, target interface{}) error

DecodeJSON decodes JSON from a reader into the target. Unknown fields in the input are rejected.

func DecodeYAML

func DecodeYAML(reader io.Reader, target interface{}) error

DecodeYAML decodes YAML from a reader into the target.

func MarshalBaseYAML

func MarshalBaseYAML[B any](c BaseConverter[B]) ([]byte, error)

MarshalBaseYAML marshals a BaseConverter by serializing its base type to YAML bytes.

func MarshalYAML

func MarshalYAML(v interface{}) ([]byte, error)

MarshalYAML marshals an object to YAML bytes.

func UnmarshalBaseYAML

func UnmarshalBaseYAML[B any](data []byte, c BaseConverter[B]) error

UnmarshalBaseYAML unmarshals YAML into a BaseConverter through its base type.

func UnmarshalYAML

func UnmarshalYAML(data []byte, target interface{}) error

UnmarshalYAML unmarshals YAML bytes into the provided target.

Types

type BaseConverter

type BaseConverter[Base any] interface {
	ToBase() Base
	FromBase(*Base)
}

BaseConverter maps between a wrapper type and its base generated type.

Jump to

Keyboard shortcuts

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