Versions in this module Expand all Collapse all v1 v1.0.1 Sep 10, 2018 v1.0.0 Apr 19, 2018 Changes in this version + var End = errors.New("end") + func Codecs() map[string]Codec + func Install(typ reflect.Type, adapter Adapter) + func Register(mimetype string, codec Codec) + func Unregister(mimetype string) + type Adapter struct + Decode func(Decoder, reflect.Value) error + Encode func(Encoder, reflect.Value) error + func AdapterOf(typ reflect.Type) (a Adapter, ok bool) + type Codec struct + NewEmitter func(io.Writer) Emitter + NewParser func(io.Reader) Parser + func Lookup(mimetype string) (Codec, bool) + func (c Codec) NewDecoder(r io.Reader) *Decoder + func (c Codec) NewEncoder(w io.Writer) *Encoder + func (c Codec) NewStreamDecoder(r io.Reader) *StreamDecoder + func (c Codec) NewStreamEncoder(w io.Writer) *StreamEncoder + type Decoder struct + MapType reflect.Type + Parser Parser + func NewDecoder(p Parser) *Decoder + func (d Decoder) Decode(v interface{}) error + func (d Decoder) DecodeArray(f func(Decoder) error) (err error) + func (d Decoder) DecodeMap(f func(Decoder, Decoder) error) (err error) + type Emitter interface + EmitArrayBegin func(int) error + EmitArrayEnd func() error + EmitArrayNext func() error + EmitBool func(bool) error + EmitBytes func([]byte) error + EmitDuration func(time.Duration) error + EmitError func(error) error + EmitFloat func(v float64, bitSize int) error + EmitInt func(v int64, bitSize int) error + EmitMapBegin func(int) error + EmitMapEnd func() error + EmitMapNext func() error + EmitMapValue func() error + EmitNil func() error + EmitString func(string) error + EmitTime func(time.Time) error + EmitUint func(v uint64, bitSize int) error + var Discard Emitter = discardEmitter{} + type Encoder struct + Emitter Emitter + SortMapKeys bool + func NewEncoder(e Emitter) *Encoder + func (e Encoder) Encode(v interface{}) (err error) + func (e Encoder) EncodeArray(n int, f func(Encoder) error) (err error) + func (e Encoder) EncodeMap(n int, f func(Encoder, Encoder) error) (err error) + type Parser interface + ParseArrayBegin func() (int, error) + ParseArrayEnd func(int) error + ParseArrayNext func(int) error + ParseBool func() (bool, error) + ParseBytes func() ([]byte, error) + ParseDuration func() (time.Duration, error) + ParseError func() (error, error) + ParseFloat func() (float64, error) + ParseInt func() (int64, error) + ParseMapBegin func() (int, error) + ParseMapEnd func(int) error + ParseMapNext func(int) error + ParseMapValue func(int) error + ParseNil func() error + ParseString func() ([]byte, error) + ParseTime func() (time.Time, error) + ParseType func() (Type, error) + ParseUint func() (uint64, error) + type PrettyEmitter interface + PrettyEmitter func() Emitter + type Registry struct + func (reg *Registry) Codecs() (codecs map[string]Codec) + func (reg *Registry) Lookup(mimetype string) (codec Codec, ok bool) + func (reg *Registry) Register(mimetype string, codec Codec) + func (reg *Registry) Unregister(mimetype string) + type StreamDecoder struct + MapType reflect.Type + Parser Parser + func NewStreamDecoder(p Parser) *StreamDecoder + func (d *StreamDecoder) Decode(v interface{}) error + func (d *StreamDecoder) Encoder(e Emitter) (enc *StreamEncoder, err error) + func (d *StreamDecoder) Err() error + func (d *StreamDecoder) Len() int + type StreamEncoder struct + Emitter Emitter + SortMapKeys bool + func NewStreamEncoder(e Emitter) *StreamEncoder + func (e *StreamEncoder) Close() error + func (e *StreamEncoder) Encode(v interface{}) error + func (e *StreamEncoder) Open(n int) error + type Type int + const Array + const Bool + const Bytes + const Duration + const Error + const Float + const Int + const Map + const Nil + const String + const Time + const Uint + const Unknown + func (t Type) String() string + type ValueDecoder interface + DecodeValue func(Decoder) error + type ValueDecoderFunc func(Decoder) error + func (f ValueDecoderFunc) DecodeValue(d Decoder) error + type ValueEmitter struct + func NewValueEmitter() *ValueEmitter + func (e *ValueEmitter) EmitArrayBegin(v int) error + func (e *ValueEmitter) EmitArrayEnd() error + func (e *ValueEmitter) EmitArrayNext() error + func (e *ValueEmitter) EmitBool(v bool) error + func (e *ValueEmitter) EmitBytes(v []byte) error + func (e *ValueEmitter) EmitDuration(v time.Duration) error + func (e *ValueEmitter) EmitError(v error) error + func (e *ValueEmitter) EmitFloat(v float64, _ int) error + func (e *ValueEmitter) EmitInt(v int64, _ int) error + func (e *ValueEmitter) EmitMapBegin(v int) error + func (e *ValueEmitter) EmitMapEnd() error + func (e *ValueEmitter) EmitMapNext() error + func (e *ValueEmitter) EmitMapValue() error + func (e *ValueEmitter) EmitNil() error + func (e *ValueEmitter) EmitString(v string) error + func (e *ValueEmitter) EmitTime(v time.Time) error + func (e *ValueEmitter) EmitUint(v uint64, _ int) error + func (e *ValueEmitter) Value() interface{} + type ValueEncoder interface + EncodeValue func(Encoder) error + type ValueEncoderFunc func(Encoder) error + func (f ValueEncoderFunc) EncodeValue(e Encoder) error + type ValueParser struct + func NewValueParser(v interface{}) *ValueParser + func (p *ValueParser) ParseArrayBegin() (n int, err error) + func (p *ValueParser) ParseArrayEnd(n int) (err error) + func (p *ValueParser) ParseArrayNext(n int) (err error) + func (p *ValueParser) ParseBool() (v bool, err error) + func (p *ValueParser) ParseBytes() (v []byte, err error) + func (p *ValueParser) ParseDuration() (v time.Duration, err error) + func (p *ValueParser) ParseError() (v error, err error) + func (p *ValueParser) ParseFloat() (v float64, err error) + func (p *ValueParser) ParseInt() (v int64, err error) + func (p *ValueParser) ParseMapBegin() (n int, err error) + func (p *ValueParser) ParseMapEnd(n int) (err error) + func (p *ValueParser) ParseMapNext(n int) (err error) + func (p *ValueParser) ParseMapValue(n int) (err error) + func (p *ValueParser) ParseNil() (err error) + func (p *ValueParser) ParseString() (v []byte, err error) + func (p *ValueParser) ParseTime() (v time.Time, err error) + func (p *ValueParser) ParseType() (Type, error) + func (p *ValueParser) ParseUint() (v uint64, err error)