marshaller

package
v1.153.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 7 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(params FactoryParams) *Factory

NewFactory for marshaller.

func (*Factory) Create added in v1.79.0

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

Create from kind.

type FactoryParams added in v1.79.0

type FactoryParams struct {
	fx.In

	JSON *JSON
	TOML *TOML
	YAML *YAML
}

FactoryParams for marshaller.

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