codec

package
v0.21.18 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(bs []byte) (interface{}, error)
	String() string
}

Codec is a simple encoding interface used for the broker/transport where headers are not supported by the underlying implementation.

type JSON

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

func NewJSONCodec

func NewJSONCodec(id string, factory func() interface{}) *JSON

func (*JSON) Marshal

func (p *JSON) Marshal(msg interface{}) ([]byte, error)

Marshal implements Codec.

func (*JSON) String

func (*JSON) String() string

func (*JSON) Unmarshal

func (p *JSON) Unmarshal(msg []byte) (interface{}, error)

Unmarshal implements Codec.

type NewCodec

type NewCodec func() Codec

NewCodec Takes in a connection/buffer and returns a new Codec

type Proto

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

Proto is a Codec for proto/snappy

func NewProtoCodec

func NewProtoCodec(id string, factory func() proto.Message) Proto

func (Proto) Marshal

func (p Proto) Marshal(msg interface{}) ([]byte, error)

Marshal implements Codec

func (Proto) String

func (p Proto) String() string

func (Proto) Unmarshal

func (p Proto) Unmarshal(bytes []byte) (interface{}, error)

Unmarshal implements Codec

type String

type String struct{}

String is a code for strings.

func (String) Marshal

func (String) Marshal(msg interface{}) ([]byte, error)

Marshal implements Codec.

func (String) String

func (String) String() string

func (String) Unmarshal

func (String) Unmarshal(bytes []byte) (interface{}, error)

Unmarshal implements Codec.

Jump to

Keyboard shortcuts

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