Documentation ¶
Index ¶
- type Reader
- func (r *Reader) Bool() (bool, error)
- func (r *Reader) Boolp() (res *bool, err error)
- func (r *Reader) Bools() (res []bool, err error)
- func (r *Reader) Bytes() ([]byte, error)
- func (r *Reader) CloseArray() error
- func (r *Reader) CloseObject() error
- func (r *Reader) Float32() (flt float32, err error)
- func (r *Reader) Float32p() (res *float32, err error)
- func (r *Reader) Float32s() (res []float32, err error)
- func (r *Reader) Float64() (flt float64, err error)
- func (r *Reader) Float64p() (res *float64, err error)
- func (r *Reader) Float64s() (res []float64, err error)
- func (r *Reader) GetPosition() int
- func (r *Reader) Int() (n int, err error)
- func (r *Reader) Int16() (n int16, err error)
- func (r *Reader) Int16p() (res *int16, err error)
- func (r *Reader) Int16s() (res []int16, err error)
- func (r *Reader) Int32() (n int32, err error)
- func (r *Reader) Int32p() (res *int32, err error)
- func (r *Reader) Int32s() (res []int32, err error)
- func (r *Reader) Int64() (n int64, err error)
- func (r *Reader) Int64p() (res *int64, err error)
- func (r *Reader) Int64s() (res []int64, err error)
- func (r *Reader) Int8() (n int8, err error)
- func (r *Reader) Int8p() (res *int8, err error)
- func (r *Reader) Int8s() (res []int8, err error)
- func (r *Reader) Intp() (res *int, err error)
- func (r *Reader) Ints() (res []int, err error)
- func (r *Reader) IsNull() bool
- func (r *Reader) Key() ([]byte, error)
- func (r *Reader) Next() bool
- func (r *Reader) OpenArray() error
- func (r *Reader) OpenObject() error
- func (r *Reader) Reset()
- func (r *Reader) SetPosition(pos int)
- func (r *Reader) Skip() (err error)
- func (r *Reader) SkipNull()
- func (r *Reader) SkipWhiteSpace()
- func (r *Reader) String() (string, error)
- func (r *Reader) Stringp() (res *string, err error)
- func (r *Reader) Strings() (res []string, err error)
- func (r *Reader) Time() (time.Time, error)
- func (r *Reader) Timep() (res *time.Time, err error)
- func (r *Reader) Times() (res []time.Time, err error)
- func (r *Reader) Token() TokenKind
- func (r *Reader) UInt() (n uint, err error)
- func (r *Reader) UInt16() (n uint16, err error)
- func (r *Reader) UInt16p() (res *uint16, err error)
- func (r *Reader) UInt16s() (res []uint16, err error)
- func (r *Reader) UInt32() (n uint32, err error)
- func (r *Reader) UInt32p() (res *uint32, err error)
- func (r *Reader) UInt32s() (res []uint32, err error)
- func (r *Reader) UInt64() (n uint64, err error)
- func (r *Reader) UInt64p() (res *uint64, err error)
- func (r *Reader) UInt64s() (res []uint64, err error)
- func (r *Reader) UInt8() (n uint8, err error)
- func (r *Reader) UInt8p() (res *uint8, err error)
- func (r *Reader) UInt8s() (res []uint8, err error)
- func (r *Reader) UIntp() (res *uint, err error)
- func (r *Reader) UInts() (res []uint, err error)
- type TokenKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func (*Reader) Bool ¶
Bool extracts the next boolean "true" or "false" value from the data and skips all whitespace after it.
func (*Reader) Bools ¶
Bools extracts an array of boolean values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Bytes ¶
Bytes returns a byte array containing the next string enclosed by quotes. If the string does not contain escaped characters, it returns data from the source directly, otherwise it allocates a temporary buffer that can be recycled between calls to the function
func (*Reader) CloseArray ¶
CloseArray consumes a closing square bracket ']' character and skips all whitespaces after it.
func (*Reader) CloseObject ¶
CloseObject consumes a closing curly brace '}' character and skips all whitespaces after it.
func (*Reader) Float32 ¶
Float32 extracts the next float32 value from the data and skips all whitespace after it.
func (*Reader) Float32s ¶
Float32s extracts an array of float32 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Float64 ¶
Float64 extracts the next float64 value from the data and skips all whitespace after it.
func (*Reader) Float64s ¶
Float64s extracts an array of float64 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) GetPosition ¶
GetPosition returns the current cursor position in the reader.
func (*Reader) Int ¶
Int extracts the next int value from the data and skips all whitespace after it.
func (*Reader) Int16 ¶
Int16 extracts the next int16 value from the data and skips all whitespace after it.
func (*Reader) Int16s ¶
Int16s extracts an array of int16 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Int32 ¶
Int32 extracts the next int32 value from the data and skips all whitespace after it.
func (*Reader) Int32s ¶
Int32s extracts an array of int32 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Int64 ¶
Int64 extracts the next int64 value from the data and skips all whitespace after it.
func (*Reader) Int64s ¶
Int64s extracts an array of int64 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Int8 ¶
Int8 extracts the next int8 value from the data and skips all whitespace after it.
func (*Reader) Int8s ¶
Int8s extracts an array of int8 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Ints ¶
Ints extracts an array of int values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Key ¶
Key extracts the next string and checks if it is followed by a colon ':' character. It returns the key if successful.
func (*Reader) Next ¶
Next checks if the next character is a comma ',' implying more data exists. If the character is a comma, it skips all whitespaces after it.
func (*Reader) OpenArray ¶
OpenArray consumes an opening square bracket '[' character and skips all whitespaces after it.
func (*Reader) OpenObject ¶
OpenObject consumes an opening curly brace '{' character and skips all whitespaces after it.
func (*Reader) Reset ¶
func (r *Reader) Reset()
Reset sets the cursor position of the reader to the beginning of the data.
func (*Reader) SetPosition ¶
SetPosition sets the cursor position int the reader.
func (*Reader) SkipNull ¶
func (r *Reader) SkipNull()
SkipNull moves the cursor forward by 4 places and skips all whitespaces after the token. Only user when it's been confirmed that the next value is null.
func (*Reader) SkipWhiteSpace ¶
func (r *Reader) SkipWhiteSpace()
SkipWhiteSpace consumes any valid whitespace characters. Valid characters are spaces ' ', tabs '\t', new lines '\n' and carriage returns '\r'.
func (*Reader) String ¶
String extracts the next string value from the data and skips all whitespace after it.
func (*Reader) Strings ¶
Ints extracts an array of string values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) Time ¶
Time extracts the next time value from the data and skips all whitespace after it. All standard time formats are processed, but RFC3339Nano is prioritized.
func (*Reader) Times ¶
Times extracts an array of time values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) UInt ¶
UInt extracts the next uint value from the data and skips all whitespace after it.
func (*Reader) UInt16 ¶
UInt16 extracts the next uint16 value from the data and skips all whitespace after it.
func (*Reader) UInt16s ¶
UInt16s extracts an array of uint16 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) UInt32 ¶
UInt32 extracts the next uint32 value from the data and skips all whitespace after it.
func (*Reader) UInt32s ¶
UInt32s extracts an array of uint32 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) UInt64 ¶
UInt64 extracts the next uint64 value from the data and skips all whitespace after it.
func (*Reader) UInt64s ¶
UInt64s extracts an array of uint64 values from the data and skips all whitespace after it. The values must be enclosed in square brackets "[...]" and the values must be separated by commas.
func (*Reader) UInt8 ¶
UInt8 extracts the next uint8 value from the data and skips all whitespace after it.
func (*Reader) UInt8s ¶
UInt8s extracts the next base64 string value enclosed in quotes and returns the value in a byte array. Skips all whitespace after the string.