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: 1

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