encoding

package
v1.282.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

Module for fx.

Functions

This section is empty.

Types

type Encoder added in v1.282.0

type Encoder interface {
	// Encode any to a writer.
	Encode(w io.Writer, e any) error

	// Decode any from a reader.
	Decode(r io.Reader, e any) error
}

Encoder allows different types of encoding/decoding.

type EncoderMap added in v1.282.0

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

MarshallerMap of marshaller.

func NewEncoderMap added in v1.282.0

func NewEncoderMap() *EncoderMap

NewMarshallerMap for marshaller.

func (*EncoderMap) Get added in v1.282.0

func (f *EncoderMap) Get(kind string) Encoder

Get from kind.

func (*EncoderMap) Register added in v1.282.0

func (f *EncoderMap) Register(kind string, enc Encoder)

Register kind and encoder.

type Marshaller

type Marshaller interface {
	// Marshal value.
	Marshal(v any) ([]byte, error)

	// Unmarshal data to value.
	Unmarshal(data []byte, v any) error
}

Marshaller allows to have different ways to marshal/unmarshal.

type MarshallerMap added in v1.282.0

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

MarshallerMap of marshaller.

func NewMarshallerMap added in v1.282.0

func NewMarshallerMap() *MarshallerMap

NewMarshallerMap for marshaller.

func (*MarshallerMap) Get added in v1.282.0

func (m *MarshallerMap) Get(kind string) Marshaller

Get from kind.

func (*MarshallerMap) Register added in v1.282.0

func (m *MarshallerMap) Register(kind string, mar Marshaller)

Register kind and marshaller.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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