Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { // Ecoder instantiates the ecnoder part of the codec with provided writer. Encoder(w io.Writer) Encoder // Decoder instantiates the decoder part of the codec with provided reader. Decoder(r io.Reader) Decoder // MimeType returns the (main) mime type of the codec. MimeType() string }
Codec can create Encoder(s) and Decoder(s) with provided io.Reader/io.Writer.
type Decoder ¶
type Decoder interface{ Decode(v interface{}) error }
Decoder is responsible for data decoding.
type DecoderFunc ¶
type DecoderFunc func(interface{}) error
DecoderFunc is a wrapper that allows using regular function as Decoder interface.
func (DecoderFunc) Decode ¶
func (fn DecoderFunc) Decode(recv interface{}) error
Decode decodes data from the reader to provided receiver.
type Encoder ¶
type Encoder interface{ Encode(v interface{}) error }
Encoder is responsible for data encoding.
type EncoderFunc ¶
type EncoderFunc func(interface{}) error
EncoderFunc is a wrapper that allows using regular function as Encoder interface.
func (EncoderFunc) Encode ¶
func (fn EncoderFunc) Encode(src interface{}) error
Encode encodes provided interface to the writer.
type Registry ¶
type Registry interface { // Lookup should find appropriate Codec by MimeType or return nil if not found. Lookup(mimeType string) Codec }
Registry represents any kind of codec registry, thus it can be global registry or a custom list of codecs that is supposed to be used for a particular case.
Click to show internal directories.
Click to hide internal directories.