codecs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec[Q, R any] interface {
	Encode(Q) ([]byte, error)
	Decode([]byte, *R) error
}

Codec defines the interface for a two way conversion between Q and R.

type GobCodec

type GobCodec[Q, R any] struct{}

GobCodec is a Codec that uses gob as the underlying format.

func (GobCodec[Q, R]) Decode

func (c GobCodec[Q, R]) Decode(b []byte, r *R) error

func (GobCodec[Q, R]) Encode

func (c GobCodec[Q, R]) Encode(q Q) ([]byte, error)

type JSONCodec

type JSONCodec[Q, R any] struct{}

JSONCodec is a Codec that uses JSON as the underlying format.

func (JSONCodec[Q, R]) Decode

func (c JSONCodec[Q, R]) Decode(b []byte, r *R) error

func (JSONCodec[Q, R]) Encode

func (c JSONCodec[Q, R]) Encode(q Q) ([]byte, error)

type TOMLCodec

type TOMLCodec[Q, R any] struct{}

TOMLCodec is a Codec that uses TOML as the underlying format.

func (TOMLCodec[Q, R]) Decode

func (c TOMLCodec[Q, R]) Decode(b []byte, r *R) error

func (TOMLCodec[Q, R]) Encode

func (c TOMLCodec[Q, R]) Encode(q Q) ([]byte, error)

Jump to

Keyboard shortcuts

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