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 ¶
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.
Click to show internal directories.
Click to hide internal directories.