serializer

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeserializeBatchEvents

func DeserializeBatchEvents(data *commonpb.DataBlob) ([]*historypb.HistoryEvent, error)

DeserializeBatchEvents deserializes batch events from a datablob proto

func DeserializeBlobDataToHistoryEvents

func DeserializeBlobDataToHistoryEvents(
	dataBlobs []*commonpb.DataBlob, filterType enumspb.HistoryEventFilterType,
) (*historypb.History, error)

DeserializeBlobDataToHistoryEvents deserialize the blob data to history event data

func NewDataBlob

func NewDataBlob(data []byte, encodingType enumspb.EncodingType) *commonpb.DataBlob

NewDataBlob creates new blob data

func NewUnknownEncodingTypeError

func NewUnknownEncodingTypeError(encodingType enumspb.EncodingType) error

NewUnknownEncodingTypeError returns a new instance of encoding type error

func SerializeBatchEvents

func SerializeBatchEvents(events []*historypb.HistoryEvent, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)

SerializeBatchEvents serializes batch events into a datablob proto

Types

type DeserializationError

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

DeserializationError is an error type for deserialization

func NewDeserializationError

func NewDeserializationError(msg string) *DeserializationError

NewDeserializationError returns a DeserializationError

func (*DeserializationError) Error

func (e *DeserializationError) Error() string

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) Encode

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

Encode protobuf struct to bytes.

type SerializationError

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

SerializationError is an error type for serialization

func NewSerializationError

func NewSerializationError(msg string) *SerializationError

NewSerializationError returns a SerializationError

func (*SerializationError) Error

func (e *SerializationError) Error() string

type UnknownEncodingTypeError

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

UnknownEncodingTypeError is an error type for unknown or unsupported encoding type

func (*UnknownEncodingTypeError) Error

func (e *UnknownEncodingTypeError) Error() string

Jump to

Keyboard shortcuts

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