Documentation
¶
Index ¶
- type JSONPBEncoder
- func (e JSONPBEncoder) Decode(data []byte, pb proto.Message) error
- func (e *JSONPBEncoder) DecodeHistories(data []byte) ([]*historypb.History, error)
- func (e *JSONPBEncoder) DecodeHistoryEvents(data []byte) ([]*historypb.HistoryEvent, error)
- func (e *JSONPBEncoder) DecodeSlice(data []byte, constructor func() proto.Message) error
- func (e JSONPBEncoder) Encode(pb proto.Message) ([]byte, error)
- func (e *JSONPBEncoder) EncodeHistories(histories []*historypb.History) ([]byte, error)
- func (e *JSONPBEncoder) EncodeHistoryEvents(historyEvents []*historypb.HistoryEvent) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONPBEncoder ¶ added in v1.2.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 v1.2.0
func NewJSONPBEncoder() JSONPBEncoder
NewJSONPBEncoder creates a new JSONPBEncoder.
func NewJSONPBIndentEncoder ¶ added in v1.2.0
func NewJSONPBIndentEncoder(indent string) JSONPBEncoder
NewJSONPBIndentEncoder creates a new JSONPBEncoder with indent.
func (JSONPBEncoder) Decode ¶ added in v1.2.0
func (e JSONPBEncoder) Decode(data []byte, pb proto.Message) error
Decode bytes to protobuf struct.
func (*JSONPBEncoder) DecodeHistories ¶ added in v1.2.0
func (e *JSONPBEncoder) DecodeHistories(data []byte) ([]*historypb.History, error)
Decode History slice from bytes.
func (*JSONPBEncoder) DecodeHistoryEvents ¶ added in v1.2.0
func (e *JSONPBEncoder) DecodeHistoryEvents(data []byte) ([]*historypb.HistoryEvent, error)
Decode HistoryEvent slice from bytes.
func (*JSONPBEncoder) DecodeSlice ¶ added in v1.2.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 v1.2.0
func (e JSONPBEncoder) Encode(pb proto.Message) ([]byte, error)
Encode protobuf struct to bytes.
func (*JSONPBEncoder) EncodeHistories ¶ added in v1.2.0
func (e *JSONPBEncoder) EncodeHistories(histories []*historypb.History) ([]byte, error)
Encode History slice to bytes.
func (*JSONPBEncoder) EncodeHistoryEvents ¶ added in v1.2.0
func (e *JSONPBEncoder) EncodeHistoryEvents(historyEvents []*historypb.HistoryEvent) ([]byte, error)
Encode HistoryEvent slice to bytes.
Click to show internal directories.
Click to hide internal directories.