codec

package
v1.26.2-123.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPBEncoder added in v0.27.0

type JSONPBEncoder struct {
	// contains filtered or unexported fields
}

JSONPBEncoder is JSON encoder/decoder for protobuf structs and slices of protobuf structs. This is an wrapper on top of jsonpb.Marshaler which supports not only single object serialization but also slices of concrete objects.

func NewJSONPBEncoder added in v0.27.0

func NewJSONPBEncoder() JSONPBEncoder

NewJSONPBEncoder creates a new JSONPBEncoder.

func NewJSONPBIndentEncoder added in v0.27.0

func NewJSONPBIndentEncoder(indent string) JSONPBEncoder

NewJSONPBIndentEncoder creates a new JSONPBEncoder with indent.

func (JSONPBEncoder) Decode added in v0.27.0

func (e JSONPBEncoder) Decode(data []byte, pb proto.Message) error

Decode bytes to protobuf struct.

func (*JSONPBEncoder) DecodeHistories added in v0.27.0

func (e *JSONPBEncoder) DecodeHistories(data []byte) ([]*historypb.History, error)

Decode History slice from bytes.

func (*JSONPBEncoder) DecodeHistoryEvents added in v0.27.0

func (e *JSONPBEncoder) DecodeHistoryEvents(data []byte) ([]*historypb.HistoryEvent, error)

Decode HistoryEvent slice from bytes.

func (*JSONPBEncoder) DecodeSlice added in v1.23.0

func (e *JSONPBEncoder) DecodeSlice(
	data []byte,
	constructor func() proto.Message) error

constructor callback must create empty object, add it to result slice, and return it.

func (JSONPBEncoder) Encode added in v0.27.0

func (e JSONPBEncoder) Encode(pb proto.Message) ([]byte, error)

Encode protobuf struct to bytes.

func (*JSONPBEncoder) EncodeHistories added in v0.27.0

func (e *JSONPBEncoder) EncodeHistories(histories []*historypb.History) ([]byte, error)

Encode History slice to bytes.

func (*JSONPBEncoder) EncodeHistoryEvents added in v0.27.0

func (e *JSONPBEncoder) EncodeHistoryEvents(historyEvents []*historypb.HistoryEvent) ([]byte, error)

Encode HistoryEvent slice to bytes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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