codec

package
v0.0.0-...-1a2806f Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PBCodec protobuf encode/decode
	PBCodec = Codec{pb.Marshal, pb.Unmarshal, pb.Name, pb.Type}
	// JSONCodec json encode/decode
	JSONCodec = Codec{json.Marshal, json.Unmarshal, json.Name, json.Type}
	// GobCodec gob encode/decode
	GobCodec = Codec{gob.Marshal, gob.Unmarshal, gob.Name, gob.Type}
	// RawCodec binary encode/decode
	RawCodec = Codec{raw.Marshal, raw.Unmarshal, raw.Name, raw.Type}
)

Functions

This section is empty.

Types

type Codec

type Codec struct {
	// marshal encode message
	Marshal func(v interface{}) ([]byte, error)
	// Unmarshal decode message
	Unmarshal func(buf []byte, v interface{}) error
	// Name of codec
	Name func() string
	Type func() int
}

Codec encodes/decodes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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