serializers

package
v0.1.51 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBORSerializer

type CBORSerializer struct {
	EncMode cbor.EncMode
	DecMode cbor.DecMode
}

func (*CBORSerializer) Deserialize

func (c *CBORSerializer) Deserialize(b []byte, i interface{}) error

func (*CBORSerializer) Serialize

func (c *CBORSerializer) Serialize(i interface{}) ([]byte, error)

func (*CBORSerializer) SerializeFuncWithBuffer

func (c *CBORSerializer) SerializeFuncWithBuffer(buff *bytes.Buffer) func(T any) ([]byte, error)

type JsonSerializer

type JsonSerializer struct {
}

func (*JsonSerializer) Deserialize

func (s *JsonSerializer) Deserialize(b []byte, i interface{}) error

func (*JsonSerializer) Serialize

func (s *JsonSerializer) Serialize(i interface{}) ([]byte, error)

type MsgpackGenSerializer

type MsgpackGenSerializer struct {
	Buffer utils.SyncPool[bytes.Buffer]
}

func (*MsgpackGenSerializer) Deserialize

func (m *MsgpackGenSerializer) Deserialize(b []byte, i interface{}) error

func (*MsgpackGenSerializer) Serialize

func (m *MsgpackGenSerializer) Serialize(i interface{}) ([]byte, error)

func (*MsgpackGenSerializer) SerializerWithCloseable

func (m *MsgpackGenSerializer) SerializerWithCloseable(i interface{}) ([]byte, func(), error)

type MsgpackSerializer

type MsgpackSerializer struct {
	Encoder utils.SyncPool[*msgpack.Encoder]
	Decoder utils.SyncPool[*msgpack.Decoder]
	Buffer  utils.SyncPool[bytes.Buffer]
}

func (*MsgpackSerializer) Deserialize

func (m *MsgpackSerializer) Deserialize(b []byte, i interface{}) error

func (*MsgpackSerializer) Serialize

func (m *MsgpackSerializer) Serialize(i interface{}) ([]byte, error)

func (*MsgpackSerializer) SerializerWithCloseable

func (m *MsgpackSerializer) SerializerWithCloseable(i interface{}) ([]byte, func(), error)

type ProtobufMarshaler added in v0.1.44

type ProtobufMarshaler interface {
	Marshal(m ProtobufMessageV1) ([]byte, error)
}

type ProtobufMessageV1 added in v0.1.44

type ProtobufMessageV1 interface {
	Reset()
	String() string
	ProtoMessage()
}

type ProtobufSerializer added in v0.1.44

type ProtobufSerializer struct {
	Encoder ProtobufMarshaler
	Decoder ProtobufUnmarshaler
}

ProtobufSerializer with support for vtproto (code-gen'd) protobuf, and standard protobuf (github.com/golang/protobuf/proto).

To use standard protobuf, set the Encoder and Decoder to proto.Marshal and proto.Unmarshal respectively. You can leave them unset if you use vtproto.

func (*ProtobufSerializer) Deserialize added in v0.1.44

func (s *ProtobufSerializer) Deserialize(b []byte, i interface{}) error

func (*ProtobufSerializer) Serialize added in v0.1.44

func (s *ProtobufSerializer) Serialize(i interface{}) ([]byte, error)

type ProtobufUnmarshaler added in v0.1.44

type ProtobufUnmarshaler interface {
	Unmarshal(b []byte, m ProtobufMessageV1) error
}

type ProtobufVTMmarshaler added in v0.1.44

type ProtobufVTMmarshaler interface {
	MarshalVT() ([]byte, error)
}

type ProtobufVTUnmarshaler added in v0.1.44

type ProtobufVTUnmarshaler interface {
	UnmarshalVT(b []byte) error
}

Jump to

Keyboard shortcuts

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