encdec

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorTextDecoderNoString = errors.New("v is not a string")
View Source
var ErrorTextDecoderNoValidPointer = errors.New("v is not a valid pointer")

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Decode(r io.Reader, v interface{}) error
}

Decoder purpose is to provide a common interface wraping around decoder libraries so that they can easily be passed as arguments values to be executed by other methods.

type DecoderFunc

type DecoderFunc func(r io.Reader, v interface{}) error

DecoderFunc type is an adapter to allow the use of ordinary functions as Decoders. If f is a function with the appropriate signature, DecoderFunc(f) is a Decoder that calls f.

func (DecoderFunc) Decode

func (e DecoderFunc) Decode(r io.Reader, v interface{}) error

Decode calls e(w,v)

type Encoder

type Encoder interface {
	Encode(w io.Writer, v interface{}) error
}

Encoder purpose is to provide a common interface wraping around encoder libraries so that they can easily be passed as arguments values to be executed by other methods.

type EncoderDecoder

type EncoderDecoder interface {
	Encoder
	Decoder
}

EncoderDecoder is the interface that groups the Encode and Decode methods.

type EncoderFunc

type EncoderFunc func(w io.Writer, v interface{}) error

EncoderFunc type is an adapter to allow the use of ordinary functions as Encoders. If f is a function with the appropriate signature, EncoderFunc(f) is a Encoder that calls f.

func (EncoderFunc) Encode

func (e EncoderFunc) Encode(w io.Writer, v interface{}) error

Encode calls e(w,v)

type JSONDecoder

type JSONDecoder struct{}

JSONDecoder implements Decoder interface to decode JSON format

func (JSONDecoder) Decode

func (j JSONDecoder) Decode(r io.Reader, v interface{}) error

Decode is a wrapper around encoding/json JSON Decoder, that read from r and store it in v

type JSONEncoder

type JSONEncoder struct{}

JSONEncoder implements Encoder interface to encode JSON format

func (JSONEncoder) Encode

func (j JSONEncoder) Encode(w io.Writer, v interface{}) error

Encode writes to w the JSON encoding of v

type JSONEncoderDecoder

type JSONEncoderDecoder struct {
	JSONEncoder
	JSONDecoder
}

JSONEncoderDecoder is a JSON EncoderDecoder implementation composed by embedding JSONEncoder and JSONDecoder types

type TextDecoder

type TextDecoder struct{}

TextDecoder implements Decoder to encode on text format

func (TextDecoder) Decode

func (t TextDecoder) Decode(r io.Reader, v interface{}) error

Decode implements Decode method of interface Decoder

type TextEncoder added in v0.8.6

type TextEncoder struct{}

TextEncoder implements Encoder to encode on text format

func (TextEncoder) Encode added in v0.8.6

func (t TextEncoder) Encode(w io.Writer, v interface{}) error

Encode implements method of Encoder interface

type XMLDecoder

type XMLDecoder struct {
}

XMLDecoder implements Decoder to decode xml format

func (XMLDecoder) Decode

func (x XMLDecoder) Decode(r io.Reader, v interface{}) error

Decode implements Decode method of interface Decoder

type XMLEncoder

type XMLEncoder struct{}

XMLEncoder implements Encoder to encode on xml format

func (XMLEncoder) Encode

func (x XMLEncoder) Encode(w io.Writer, v interface{}) error

Encode implements method of Encoder interface

type XMLEncoderDecoder

type XMLEncoderDecoder struct {
	XMLEncoder
	XMLDecoder
}

XMLEncoderDecoder is a xml EncoderDecoder implementation composed by embedding XMLEncoder and XMLDecoder

Jump to

Keyboard shortcuts

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