marshal

package
v1.0.82 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 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 ErrUnmarshallingBadSize = errors.New("imput buffer too long")

ErrUnmarshallingBadSize is raised when the provided serialized data size exceeds the re-serialized data size plus an additional provided delta

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 CapnpHelper added in v1.0.77

type CapnpHelper interface {
	// Save saves the serialized data of the implementer type into a stream through Capnp protocol
	Save(w io.Writer) error
	// Load loads the data from the stream into a go structure through Capnp protocol
	Load(r io.Reader) error
}

CapnpHelper is an interface that defines methods needed for serializing and deserializing Capnp structures into Go structures and viceversa

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)

func NewSizeCheckUnmarshalizer

func NewSizeCheckUnmarshalizer(m Marshalizer, maxDelta uint32) Marshalizer

NewSizeCheckUnmarshalizer creates a wrapper around an existing marshalizer m which, during unmarshaling, also checks that the provided buffer dose not contain additional unused data.

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