codec

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONPBEncoder

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

func NewJSONPBEncoder() JSONPBEncoder

NewJSONPBEncoder creates a new JSONPBEncoder.

func NewJSONPBIndentEncoder

func NewJSONPBIndentEncoder(indent string) JSONPBEncoder

NewJSONPBIndentEncoder creates a new JSONPBEncoder with indent.

func (JSONPBEncoder) Decode

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

Decode bytes to protobuf struct.

func (*JSONPBEncoder) DecodeHistories

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

Decode History slice from bytes.

func (*JSONPBEncoder) DecodeHistoryEvents

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

Decode HistoryEvent slice from bytes.

func (*JSONPBEncoder) DecodeSlice

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

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

Encode protobuf struct to bytes.

func (*JSONPBEncoder) EncodeHistories

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

Encode History slice to bytes.

func (*JSONPBEncoder) EncodeHistoryEvents

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

Encode HistoryEvent slice to bytes.

Jump to

Keyboard shortcuts

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