serializers

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 5 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 ProtobufMarshaler added in v0.1.44

type ProtobufMarshaler interface {
	Marshal(m proto.Message) ([]byte, error)
}

type ProtobufSerializer added in v0.1.44

type ProtobufSerializer struct {
	Encoder ProtobufMarshaler
	Decoder ProtobufUnmarshaler
	SkipVT  bool
}

ProtobufSerializer with support for vtproto (code-gen'd) protobuf, and standard protobuf (google.golang.org/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 proto.Message) 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
}

Directories

Path Synopsis
pb

Jump to

Keyboard shortcuts

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