codecs

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONCodecName  = "application/json"
	ProtoCodecName = "application/protobuf"
	XMLCodecName   = "application/xml"
)

Variables

View Source
var NotProtoMessage = errors.New("not proto message")
View Source
var Register = register{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Encoder
	Decoder
}

Codec is an interface that encodes message on pub and decodes it on sub.

type Decoder

type Decoder interface {
	Decode([]byte, interface{}) error
}

type Encoder

type Encoder interface {
	Encode(interface{}) ([]byte, error)
}

type JSONCodec

type JSONCodec struct {
}

func (*JSONCodec) Decode

func (c *JSONCodec) Decode(data []byte, v interface{}) error

func (*JSONCodec) Encode

func (c *JSONCodec) Encode(v interface{}) ([]byte, error)

type ProtobufCodec

type ProtobufCodec struct {
}

func (*ProtobufCodec) Decode

func (c *ProtobufCodec) Decode(data []byte, v interface{}) error

func (*ProtobufCodec) Encode

func (c *ProtobufCodec) Encode(v interface{}) ([]byte, error)

type XMLCodec

type XMLCodec struct {
}

func (*XMLCodec) Decode

func (c *XMLCodec) Decode(data []byte, v interface{}) error

func (*XMLCodec) Encode

func (c *XMLCodec) Encode(v interface{}) ([]byte, error)

Jump to

Keyboard shortcuts

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