decoder

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 22 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretouch

func Pretouch(vt reflect.Type) (err error)

Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in order to reduce the first-hit latency.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder is the decoder context object

func NewDecoder

func NewDecoder(s string) *Decoder

NewDecoder creates a new decoder instance.

func (*Decoder) Decode

func (self *Decoder) Decode(val interface{}) error

Decode parses the JSON-encoded data from current position and stores the result in the value pointed to by val.

func (*Decoder) DisallowUnknownFields

func (self *Decoder) DisallowUnknownFields()

DisallowUnknownFields causes the Decoder to return an error when the destination is a struct and the input contains object keys which do not match any non-ignored, exported fields in the destination.

func (*Decoder) Pos

func (self *Decoder) Pos() int

Pos returns the current decoding position.

func (*Decoder) UseInt64

func (self *Decoder) UseInt64()

UseInt64 causes the Decoder to unmarshal an integer into an interface{} as an int64 instead of as a float64.

func (*Decoder) UseNumber

func (self *Decoder) UseNumber()

UseNumber causes the Decoder to unmarshal a number into an interface{} as a json.Number instead of as a float64.

func (*Decoder) UseUnicodeErrors

func (self *Decoder) UseUnicodeErrors()

UseUnicodeErrors causes the Decoder to return an error when encounter invalid UTF-8 escape sequences.

type SyntaxError

type SyntaxError struct {
	Pos  int
	Src  string
	Code types.ParsingError
}

func (SyntaxError) Description

func (self SyntaxError) Description() string

func (SyntaxError) Error

func (self SyntaxError) Error() string

Jump to

Keyboard shortcuts

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