cherrySerializer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongValueType = cherryUtils.Error("protobuf: convert on wrong type value")
)

Functions

This section is empty.

Types

type JSONSerializer

type JSONSerializer struct{}

func NewJSON

func NewJSON() *JSONSerializer

func (*JSONSerializer) Marshal

func (j *JSONSerializer) Marshal(v interface{}) ([]byte, error)

Marshal returns the JSON encoding of v.

func (*JSONSerializer) Name

func (j *JSONSerializer) Name() string

Name returns the name of the serializer.

func (*JSONSerializer) Unmarshal

func (j *JSONSerializer) Unmarshal(data []byte, v interface{}) error

Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.

type ProtobufSerializer

type ProtobufSerializer struct{}

ProtobufSerializer implements the serialize.ProtobufSerializer interface

func NewProtobuf

func NewProtobuf() *ProtobufSerializer

NewSerializer returns a new ProtobufSerializer.

func (*ProtobufSerializer) Marshal

func (p *ProtobufSerializer) Marshal(v interface{}) ([]byte, error)

Marshal returns the protobuf encoding of v.

func (*ProtobufSerializer) Name

func (p *ProtobufSerializer) Name() string

Name returns the name of the serializer.

func (*ProtobufSerializer) Unmarshal

func (p *ProtobufSerializer) Unmarshal(data []byte, v interface{}) error

Unmarshal parses the protobuf-encoded data and stores the result in the value pointed to by v.

Jump to

Keyboard shortcuts

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