jsondecoder

package
v0.0.0-...-eb4175f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const PhasePanicMsg = "JSON decoder out of sync - data changing underfoot?"

PhasePanicMsg is used as a panic message when we end up with something that shouldn't happen. It can indicate a bug in the JSON decoder, or that something is editing the data slice while the decoder executes.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

func New

func New(data []byte) (*Decoder, error)

func (*Decoder) BeforeReadArray

func (dec *Decoder) BeforeReadArray(jsonKey string) (isNULL bool, err error)

func (*Decoder) BeforeReadMap

func (dec *Decoder) BeforeReadMap(jsonKey string) (isNULL bool, err error)

func (*Decoder) BeforeReadNext

func (dec *Decoder) BeforeReadNext(jsonKey string) (isEnd bool, err error)

func (*Decoder) BeforeReadObject

func (dec *Decoder) BeforeReadObject(jsonKey string) (isNULL bool, err error)

func (*Decoder) BeforeScanJSON

func (dec *Decoder) BeforeScanJSON() (isNULL bool, err error)

BeforeScanJSON only used to check if the JSON is NULL before loop scan.

func (*Decoder) BeforeScanNext

func (dec *Decoder) BeforeScanNext() (isEnd bool, err error)

BeforeScanNext only used to before read JSON key that in top level.

func (*Decoder) DiscardValue

func (dec *Decoder) DiscardValue(jsonKey string) (err error)

DiscardValue used to discard the next value.

func (*Decoder) NextLiteralIsNULL

func (dec *Decoder) NextLiteralIsNULL(jsonKey string) (isNULL bool, err error)

NextLiteralIsNULL only used to check if the next value that type of pointer value is NULL.

func (*Decoder) ReadJSONKey

func (dec *Decoder) ReadJSONKey() (jsonKey string, err error)

ReadJSONKey used to read JSON key that in top level. The `jsonKey` is unsafe after unmarshal end.

func (*Decoder) ReadLiteralBool

func (dec *Decoder) ReadLiteralBool(jsonKey string, unquote bool) (vv bool, err error)

func (*Decoder) ReadLiteralBytes

func (dec *Decoder) ReadLiteralBytes(jsonKey string) (vv []byte, err error)

func (*Decoder) ReadLiteralEnumNumber

func (dec *Decoder) ReadLiteralEnumNumber(jsonKey string, unquote bool) (vv int32, err error)

func (*Decoder) ReadLiteralEnumString

func (dec *Decoder) ReadLiteralEnumString(jsonKey string, em map[string]int32) (vv int32, err error)

func (*Decoder) ReadLiteralFloat32

func (dec *Decoder) ReadLiteralFloat32(jsonKey string, unquote bool) (vv float32, err error)

func (*Decoder) ReadLiteralFloat64

func (dec *Decoder) ReadLiteralFloat64(jsonKey string, unquote bool) (vv float64, err error)

func (*Decoder) ReadLiteralInt32

func (dec *Decoder) ReadLiteralInt32(jsonKey string, unquote bool) (vv int32, err error)

func (*Decoder) ReadLiteralInt64

func (dec *Decoder) ReadLiteralInt64(jsonKey string, unquote bool) (vv int64, err error)

func (*Decoder) ReadLiteralInterface

func (dec *Decoder) ReadLiteralInterface(jsonKey string, vv interface{}) (err error)

func (*Decoder) ReadLiteralString

func (dec *Decoder) ReadLiteralString(jsonKey string) (vv string, err error)

func (*Decoder) ReadLiteralUint32

func (dec *Decoder) ReadLiteralUint32(jsonKey string, unquote bool) (vv uint32, err error)

func (*Decoder) ReadLiteralUint64

func (dec *Decoder) ReadLiteralUint64(jsonKey string, unquote bool) (vv uint64, err error)

func (*Decoder) ReadMapKeyBool

func (dec *Decoder) ReadMapKeyBool(jsonKey string, unquote bool) (vv bool, err error)

func (*Decoder) ReadMapKeyInt32

func (dec *Decoder) ReadMapKeyInt32(jsonKey string, unquote bool) (vv int32, err error)

func (*Decoder) ReadMapKeyInt64

func (dec *Decoder) ReadMapKeyInt64(jsonKey string, unquote bool) (vv int64, err error)

func (*Decoder) ReadMapKeyString

func (dec *Decoder) ReadMapKeyString(jsonKey string) (vv string, err error)

func (*Decoder) ReadMapKeyUint32

func (dec *Decoder) ReadMapKeyUint32(jsonKey string, unquote bool) (vv uint32, err error)

func (*Decoder) ReadMapKeyUint64

func (dec *Decoder) ReadMapKeyUint64(jsonKey string, unquote bool) (vv uint64, err error)

func (*Decoder) ReadObjectKey

func (dec *Decoder) ReadObjectKey(jsonKey string) (objKey string, err error)

ReadObjectKey is wrappers for readObjectKey. The `objKey` is unsafe after unmarshal end.

func (*Decoder) ReadPointerBool

func (dec *Decoder) ReadPointerBool(jsonKey string, unquote bool) (vv *bool, err error)

func (*Decoder) ReadPointerEnumNumber

func (dec *Decoder) ReadPointerEnumNumber(jsonKey string, unquote bool) (vv *int32, err error)

func (*Decoder) ReadPointerEnumString

func (dec *Decoder) ReadPointerEnumString(jsonKey string, em map[string]int32) (vv *int32, err error)

func (*Decoder) ReadPointerFloat32

func (dec *Decoder) ReadPointerFloat32(jsonKey string, unquote bool) (vv *float32, err error)

func (*Decoder) ReadPointerFloat64

func (dec *Decoder) ReadPointerFloat64(jsonKey string, unquote bool) (vv *float64, err error)

func (*Decoder) ReadPointerInt32

func (dec *Decoder) ReadPointerInt32(jsonKey string, unquote bool) (vv *int32, err error)

func (*Decoder) ReadPointerInt64

func (dec *Decoder) ReadPointerInt64(jsonKey string, unquote bool) (vv *int64, err error)

func (*Decoder) ReadPointerString

func (dec *Decoder) ReadPointerString(jsonKey string) (vv *string, err error)

func (*Decoder) ReadPointerUint32

func (dec *Decoder) ReadPointerUint32(jsonKey string, unquote bool) (vv *uint32, err error)

func (*Decoder) ReadPointerUint64

func (dec *Decoder) ReadPointerUint64(jsonKey string, unquote bool) (vv *uint64, err error)

func (*Decoder) ReadWKTAnyByProto

func (dec *Decoder) ReadWKTAnyByProto(jsonKey string, vv *any.Any) (err error)

func (*Decoder) ReadWKTDurationByHours

func (dec *Decoder) ReadWKTDurationByHours(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationByMicroseconds

func (dec *Decoder) ReadWKTDurationByMicroseconds(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationByMilliseconds

func (dec *Decoder) ReadWKTDurationByMilliseconds(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationByMinutes

func (dec *Decoder) ReadWKTDurationByMinutes(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationByNanoseconds

func (dec *Decoder) ReadWKTDurationByNanoseconds(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationBySeconds

func (dec *Decoder) ReadWKTDurationBySeconds(jsonKey string, vv *durationpb.Duration, unquote bool) (err error)

func (*Decoder) ReadWKTDurationByString

func (dec *Decoder) ReadWKTDurationByString(jsonKey string, vv *durationpb.Duration) (err error)

func (*Decoder) ReadWKTTimestampByString

func (dec *Decoder) ReadWKTTimestampByString(jsonKey string, vv *timestamppb.Timestamp, layout string) (err error)

func (*Decoder) ReadWKTTimestampByUnixMicro

func (dec *Decoder) ReadWKTTimestampByUnixMicro(jsonKey string, vv *timestamppb.Timestamp, unquote bool) (err error)

func (*Decoder) ReadWKTTimestampByUnixMilli

func (dec *Decoder) ReadWKTTimestampByUnixMilli(jsonKey string, vv *timestamppb.Timestamp, unquote bool) (err error)

func (*Decoder) ReadWKTTimestampByUnixNano

func (dec *Decoder) ReadWKTTimestampByUnixNano(jsonKey string, vv *timestamppb.Timestamp, unquote bool) (err error)

func (*Decoder) ReadWKTTimestampByUnixSec

func (dec *Decoder) ReadWKTTimestampByUnixSec(jsonKey string, vv *timestamppb.Timestamp, unquote bool) (err error)

type Error

type Error struct {
	Field  string // The key of JSON. Maybe empty if error in top level.
	Offset int    // The offset in JSON input.
	Reason string // The message of error reason.
}

func (*Error) Error

func (e *Error) Error() string

type OpCode

type OpCode int8

type ParsePhase

type ParsePhase int8

Jump to

Keyboard shortcuts

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