marshaller

package
v1.172.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKind = errors.New("invalid kind")

ErrInvalidKind for marshaller.

Module for fx.

Functions

This section is empty.

Types

type Factory added in v1.79.0

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

Factory of marshaller.

func NewFactory added in v1.79.0

func NewFactory() *Factory

NewFactory for marshaller.

func (*Factory) Create added in v1.79.0

func (f *Factory) Create(kind string) (Marshaller, error)

Create from kind.

func (*Factory) Register added in v1.156.0

func (f *Factory) Register(kind string, m Marshaller)

Register kind and marshaller.

type GOB added in v1.158.0

type GOB struct{}

GOB for marshaller.

func NewGOB added in v1.158.0

func NewGOB() *GOB

NewJSON for marshaller.

func (*GOB) Marshal added in v1.158.0

func (m *GOB) Marshal(v any) ([]byte, error)

func (*GOB) Unmarshal added in v1.158.0

func (m *GOB) Unmarshal(data []byte, v any) error

type JSON added in v1.141.0

type JSON struct{}

JSON for marshaller.

func NewJSON added in v1.141.0

func NewJSON() *JSON

NewJSON for marshaller.

func (*JSON) Marshal added in v1.141.0

func (m *JSON) Marshal(v any) ([]byte, error)

func (*JSON) Unmarshal added in v1.141.0

func (m *JSON) Unmarshal(data []byte, v any) error

type Marshaller

type Marshaller interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, v any) error
}

Marshaller allows to have different ways to marshal/unmarshal.

type Proto added in v1.78.0

type Proto struct{}

Proto for marshaller.

func NewProto

func NewProto() *Proto

NewProto for marshaller.

func (*Proto) Marshal added in v1.78.0

func (m *Proto) Marshal(v any) ([]byte, error)

func (*Proto) Unmarshal added in v1.78.0

func (m *Proto) Unmarshal(data []byte, v any) error

type TOML added in v1.80.0

type TOML struct{}

TOML for marshaller.

func NewTOML added in v1.80.0

func NewTOML() *TOML

NewTOML for marshaller.

func (*TOML) Marshal added in v1.80.0

func (m *TOML) Marshal(v any) ([]byte, error)

func (*TOML) Unmarshal added in v1.80.0

func (m *TOML) Unmarshal(data []byte, v any) error

type YAML added in v1.78.0

type YAML struct{}

YAML for marshaller.

func NewYAML added in v1.78.0

func NewYAML() *YAML

NewYAML for marshaller.

func (*YAML) Marshal added in v1.78.0

func (m *YAML) Marshal(v any) ([]byte, error)

func (*YAML) Unmarshal added in v1.78.0

func (m *YAML) Unmarshal(data []byte, v any) error

Jump to

Keyboard shortcuts

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