marshal

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMarshallingProto = errors.New("can not serialize the object")

ErrMarshallingProto is raised when the object does not implement proto.Message

View Source
var ErrUnmarshallingProto = errors.New("obj does not implement proto.Message")

ErrUnmarshallingProto is raised when the object that needs to be unmarshaled does not implement proto.Message

Functions

This section is empty.

Types

type CapnpMarshalizer added in v1.0.3

type CapnpMarshalizer struct {
}

CapnpMarshalizer implements marshaling with capnproto

func (*CapnpMarshalizer) IsInterfaceNil added in v1.0.16

func (x *CapnpMarshalizer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CapnpMarshalizer) Marshal added in v1.0.3

func (x *CapnpMarshalizer) Marshal(obj interface{}) ([]byte, error)

Marshal does the actual serialization of an object through capnproto The object to be serialized must implement the data.CapnpHelper interface

func (*CapnpMarshalizer) Unmarshal added in v1.0.3

func (x *CapnpMarshalizer) Unmarshal(obj interface{}, buff []byte) error

Unmarshal does the actual deserialization of an object through capnproto The object to be deserialized must implement the data.CapnpHelper interface

type JsonMarshalizer

type JsonMarshalizer struct {
}

JsonMarshalizer implements Marshalizer interface using JSON format

func (*JsonMarshalizer) IsInterfaceNil

func (j *JsonMarshalizer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (JsonMarshalizer) Marshal

func (j JsonMarshalizer) Marshal(obj interface{}) ([]byte, error)

Marshal tries to serialize obj parameter

func (JsonMarshalizer) Unmarshal

func (j JsonMarshalizer) Unmarshal(obj interface{}, buff []byte) error

Unmarshal tries to deserialize input buffer values into input object

type Marshalizer

type Marshalizer interface {
	Marshal(obj interface{}) ([]byte, error)
	Unmarshal(obj interface{}, buff []byte) error
	IsInterfaceNil() bool
}

Marshalizer defines the 2 basic operations: serialize (marshal) and deserialize (unmarshal)

type ProtobufMarshalizer added in v1.0.3

type ProtobufMarshalizer struct {
}

ProtobufMarshalizer implements marshaling with protobuf

func (*ProtobufMarshalizer) IsInterfaceNil added in v1.0.16

func (x *ProtobufMarshalizer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ProtobufMarshalizer) Marshal added in v1.0.3

func (x *ProtobufMarshalizer) Marshal(obj interface{}) ([]byte, error)

Marshal does the actual serialization of an object through capnproto The object to be serialized must implement the data.CapnpHelper interface

func (*ProtobufMarshalizer) Unmarshal added in v1.0.3

func (x *ProtobufMarshalizer) Unmarshal(obj interface{}, buff []byte) error

Unmarshal does the actual deserialization of an object through capnproto The object to be deserialized must implement the data.CapnpHelper interface

Jump to

Keyboard shortcuts

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