ctcodecs

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

ctcodecs

Go mime type base codecs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

func Register

func Register(mimeType string, c Codec)

Register adds a new codec for mimeType.

Types

type Codec

type Codec interface {
	MimeType() string
	NewEncoder(w io.Writer) Encoder
	NewDecoder(r io.Reader) Decoder
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

func New

func New(mimeType string) (Codec, error)

New returns a codec for the mime type in mimeType. Error if there's no codec for specified mime type.

type Decoder

type Decoder interface {
	Decode(i interface{}) error
}

type Encoder

type Encoder interface {
	Encode(i interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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