serializers

package
v0.211.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FormURLEncoder

type FormURLEncoder struct{}

func (FormURLEncoder) Marshal

func (e FormURLEncoder) Marshal(v any) ([]byte, error)

func (FormURLEncoder) Unmarshal

func (e FormURLEncoder) Unmarshal(data []byte, iptr any) error

type JSON

type JSON struct{}

func (JSON) MakeListDecoder added in v0.209.0

func (s JSON) MakeListDecoder(r io.Reader) ListDecoder

func (JSON) MakeListEncoder added in v0.209.0

func (s JSON) MakeListEncoder(w io.Writer) ListEncoder

func (JSON) Marshal

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

func (JSON) Unmarshal

func (s JSON) Unmarshal(data []byte, dtoPtr any) error

type JSONStream

type JSONStream struct{}

func (JSONStream) MakeListEncoder added in v0.209.0

func (s JSONStream) MakeListEncoder(w io.Writer) ListEncoder

func (JSONStream) Marshal

func (s JSONStream) Marshal(v any) ([]byte, error)

func (JSONStream) NewListDecoder

func (s JSONStream) NewListDecoder(w io.ReadCloser) ListDecoder

func (JSONStream) Unmarshal

func (s JSONStream) Unmarshal(data []byte, ptr any) error

type ListDecoder

type ListDecoder interface {
	Decode(ptr any) error
	// Next will ensure that Value returns the next item when executed.
	// If the next value is not retrievable, Next should return false and ensure Err() will return the error cause.
	Next() bool
	// Err return the error cause.
	Err() error
	// Closer is required to make it able to cancel iterators where resources are being used behind the scene
	// for all other cases where the underling io is handled on a higher level, it should simply return nil
	io.Closer
}

type ListDecoderMaker

type ListDecoderMaker interface {
	MakeListDecoder(w io.Reader) ListDecoder
}

type ListEncoder

type ListEncoder interface {
	// Encode will encode an Entity in the underlying io writer.
	Encode(v any) error
	// Closer represent the finishing of the List encoding process.
	io.Closer
}

type ListEncoderMaker

type ListEncoderMaker interface {
	MakeListEncoder(w io.Writer) ListEncoder
}

type ListSerializer

type ListSerializer interface {
	ListEncoderMaker
	ListDecoderMaker
}

type Serializer

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

Jump to

Keyboard shortcuts

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