serializers

package
v0.208.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 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) Marshal

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

func (JSON) NewListDecoder

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

func (JSON) NewListEncoder

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

func (JSON) Unmarshal

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

type JSONStream

type JSONStream struct{}

func (JSONStream) Marshal

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

func (JSONStream) NewListDecoder

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

func (JSONStream) NewListEncoder

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

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 {
	NewListDecoder(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 {
	NewListEncoder(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