codec

package
v0.0.0-...-3408d66 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Gob is a Codec that uses the gob package
	Gob = Codec{gobMarshal, gobUnmarshal}
	// JSON is a Codec that uses the json package.
	JSON = Codec{json.Marshal, json.Unmarshal}
	// XML is a codec that uses the xml pacakge
	XML = Codec{xml.Marshal, xml.Unmarshal}
	// BSON is a codec that used the labix.org/v2/mgo/bson pacakge
	BSON = Codec{bson.Marshal, bson.Unmarshal}
	// ErrTestCodec is a codec that returns errors, used for testing other packages.
	ErrTestCodec = Codec{testMarshalErr, testUnmarshalErr}
)

Functions

This section is empty.

Types

type Codec

type Codec struct {
	Marshal   func(interface{}) ([]byte, error)
	Unmarshal func([]byte, interface{}) error
}

Codec defines an interface for encoding/decoding Go values to bytes

Jump to

Keyboard shortcuts

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