gmarshaller

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarshallerTypeJSON            = "json"
	MarshallerTypeJSONNum         = 1
	MarshallerTypeProtoBuf        = "protobuf"
	MarshallerTypeProtoBufNum     = 2
	MarshallerTypeProtoBufComp    = "protobufcomp"
	MarshallerTypeProtoBufCompNum = 3
)
View Source
const (
	ProtoCompressLengthLimit = 512
	ProtoCompressFlagZstd    = byte(1)<<6 | 7 // 01000111
)

Variables

View Source
var (
	ErrCanNotMarshalAsProtobufMsg   = errors.New("ERR_CAN_NOT_MARSHAL_AS_PROTOBUF_MSG")
	ErrCanNotUnmarshalAsProtobufMsg = errors.New("ERR_CAN_NOT_UNMARSHAL_AS_PROTOBUF_MSG")
	ErrCompressFailed               = errors.New("ERR_COMPRESS_FAILED")
	ErrDecompressFailed             = errors.New("ERR_DECOMPRESS_FAILED")
	ErrMarshalFailed                = errors.New("ERR_DB_MARSHAL_FAILED")
	ErrUnmarshalFailed              = errors.New("ERR_DB_UNMARSHAL_FAILED")
)

Functions

This section is empty.

Types

type JsonMarshaller

type JsonMarshaller struct{}

func (*JsonMarshaller) Marshal

func (jm *JsonMarshaller) Marshal(v interface{}) ([]byte, error)

func (*JsonMarshaller) Unmarshal

func (jm *JsonMarshaller) Unmarshal(data []byte, v interface{}) error

type Marshaller

type Marshaller interface {
	Marshal(interface{}) ([]byte, error)
	Unmarshal([]byte, interface{}) error
}

type ProtoCompressMarshaller

type ProtoCompressMarshaller struct{}

func (*ProtoCompressMarshaller) Marshal

func (pcm *ProtoCompressMarshaller) Marshal(v interface{}) ([]byte, error)

func (*ProtoCompressMarshaller) Unmarshal

func (pcm *ProtoCompressMarshaller) Unmarshal(data []byte, v interface{}) error

type ProtoMarshaller

type ProtoMarshaller struct{}

func (*ProtoMarshaller) Marshal

func (pm *ProtoMarshaller) Marshal(v interface{}) ([]byte, error)

func (*ProtoMarshaller) Unmarshal

func (pm *ProtoMarshaller) Unmarshal(data []byte, v interface{}) error

type SelfMarshaller

type SelfMarshaller interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

Jump to

Keyboard shortcuts

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