marshaler

package
v1.0.33 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKindMarshalerTypeMissing            = errorer.New("type missing")
	ErrKindMarshalerTypeNotRegistered      = errorer.New("type not registered")
	ErrKindMarshalerTypeNotRegisteredv     = ErrKindMarshalerTypeNotRegistered.ValueFn()
	ErrKindMarshalerTypeAlreadyRegistered  = errorer.New("type already registered")
	ErrKindMarshalerTypeAlreadyRegisteredv = ErrKindMarshalerTypeAlreadyRegistered.ValueFn()
)
View Source
var (
	ErrTypedMarshalerTypeMissing            = errorer.New("type missing")
	ErrTypedMarshalerTypeNotRegistered      = errorer.New("type not registered")
	ErrTypedMarshalerTypeNotRegisteredv     = ErrTypedMarshalerTypeNotRegistered.ValueFn()
	ErrTypedMarshalerTypeAlreadyRegistered  = errorer.New("type already registered")
	ErrTypedMarshalerTypeAlreadyRegisteredv = ErrTypedMarshalerTypeAlreadyRegistered.ValueFn()
)

Functions

This section is empty.

Types

type KindMarshaler added in v1.0.29

type KindMarshaler[D any] struct {
	Formatted bool
	// contains filtered or unexported fields
}

func NewKind added in v1.0.29

func NewKind[D any](val D, fn func(D) string) *KindMarshaler[D]

func (KindMarshaler[D]) Marshal added in v1.0.29

func (t KindMarshaler[D]) Marshal(val any) ([]byte, error)

func (*KindMarshaler[D]) RegisterNamer added in v1.0.29

func (t *KindMarshaler[D]) RegisterNamer(namer TypeNamer) error

func (*KindMarshaler[D]) RegisterType added in v1.0.29

func (t *KindMarshaler[D]) RegisterType(discriminator string, typ reflect.Type) error

func (*KindMarshaler[D]) RegisterValue added in v1.0.29

func (t *KindMarshaler[D]) RegisterValue(discriminator string, val any) error

func (KindMarshaler[D]) Unmarshal added in v1.0.29

func (t KindMarshaler[D]) Unmarshal(data []byte) (any, error)

type TypeNamer added in v1.0.29

type TypeNamer interface {
	TypeName() string
}

type TypedMarshaler added in v1.0.29

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

func NewTyped added in v1.0.29

func NewTyped() *TypedMarshaler

func (TypedMarshaler) Marshal added in v1.0.29

func (t TypedMarshaler) Marshal(namer TypeNamer) ([]byte, error)

func (*TypedMarshaler) Register added in v1.0.29

func (t *TypedMarshaler) Register(namers ...TypeNamer) error

func (TypedMarshaler) Unmarshal added in v1.0.29

func (t TypedMarshaler) Unmarshal(data []byte) (any, error)

Jump to

Keyboard shortcuts

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