serializer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferSerializer

type BufferSerializer struct {
	*bytes.Buffer
}

BufferSerializer implements Serializer interface by bytes.Buffer.

func NewBuffer

func NewBuffer(length int) *BufferSerializer

func (*BufferSerializer) Decode

func (buffer *BufferSerializer) Decode(container interface{}) error

func (*BufferSerializer) DecodeAndRelease

func (buffer *BufferSerializer) DecodeAndRelease(container interface{}) error

func (*BufferSerializer) Release

func (buffer *BufferSerializer) Release()

type Serializer

type Serializer interface {
	// Bytes returns the origin bytes data.
	Bytes() []byte

	// Decode serialize bytes to pointer value.
	Decode(container interface{}) error

	// Release put bytes to pool, avoiding memory leak and improve GC performance
	Release()

	// DecodeAndRelease execute Decode and Release function
	DecodeAndRelease(container interface{}) error
}

Serializer provide bytes serialization to pointer

type SerializerBuilder

type SerializerBuilder func() Serializer

Jump to

Keyboard shortcuts

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