codec

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package codec contains sub-packages with different codecs that can be used to encode/decode any entity to/from a byte stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tester

func Tester(t *testing.T, c Codec)

Tester is a test helper to test a Codec. It encodes a test struct using the given codec and decodes it into a second test struct afterwards. It then uses the reflect pkg to check if both structs have the exact same values.

Types

type Codec

type Codec interface {
	// Encode encodes the value to a byte slice.
	Encode(v interface{}) ([]byte, error)

	// Decode decodes the byte slice into the value.
	Decode(b []byte, v interface{}) error
}

Codec represents a codec used to encode and decode entities.

Directories

Path Synopsis
Package json offers an implementation of the codec.Codec interface for the json data format.
Package json offers an implementation of the codec.Codec interface for the json data format.
Package msgpack offers an implementation of the codec.Codec interface for the msgpack data format.
Package msgpack offers an implementation of the codec.Codec interface for the msgpack data format.

Jump to

Keyboard shortcuts

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