codec

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

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

	// CodecID is a short identifier to communicate what codec should be used to decode the value.
	// Once in use, this should be stable to avoid confusing other clients.
	CodecID() string
}

Codec allows KV clients to serialise and deserialise values.

type Proto

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

Proto is a Codec for proto/snappy

func NewProtoCodec added in v0.7.0

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

func (Proto) CodecID added in v0.7.0

func (p Proto) CodecID() string

func (Proto) Decode

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

Decode implements Codec

func (Proto) Encode

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

Encode implements Codec

type String

type String struct{}

String is a code for strings.

func (String) CodecID added in v0.7.0

func (String) CodecID() string

func (String) Decode

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

Decode implements Codec.

func (String) Encode

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

Encode implements Codec.

Jump to

Keyboard shortcuts

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