Documentation ¶
Index ¶
- type Iterator
- func (iter *Iterator) CurrentBuffer() string
- func (iter *Iterator) ReadArrayHead() bool
- func (iter *Iterator) ReadArrayMore() bool
- func (iter *Iterator) ReadBigFloat(out *big.Float) error
- func (iter *Iterator) ReadBigInt(out *big.Int) error
- func (iter *Iterator) ReadBool(out *bool) error
- func (iter *Iterator) ReadFloat32(out *float32) error
- func (iter *Iterator) ReadFloat64(out *float64) error
- func (iter *Iterator) ReadInt(out *int) (err error)
- func (iter *Iterator) ReadInt16(out *int16) (ret error)
- func (iter *Iterator) ReadInt32(out *int32) (ret error)
- func (iter *Iterator) ReadInt64(out *int64) (ret error)
- func (iter *Iterator) ReadInt8(out *int8) (ret error)
- func (iter *Iterator) ReadInterface(out *interface{}) (ret error)
- func (iter *Iterator) ReadNumber(out *Number) error
- func (iter *Iterator) ReadObjectField() string
- func (iter *Iterator) ReadObjectHead() bool
- func (iter *Iterator) ReadObjectMore() bool
- func (iter *Iterator) ReadRawMessage(out *RawMessage) (ret error)
- func (iter *Iterator) ReadString(out *string) error
- func (iter *Iterator) ReadUint(out *uint) (err error)
- func (iter *Iterator) ReadUint16(out *uint16) (ret error)
- func (iter *Iterator) ReadUint32(out *uint32) (ret error)
- func (iter *Iterator) ReadUint64(out *uint64) (ret error)
- func (iter *Iterator) ReadUint8(out *uint8) (ret error)
- func (iter *Iterator) ReportError(operation string, msg string) error
- func (iter *Iterator) Skip() error
- type JsonAdapter
- type Number
- type RawMessage
- type Stream
- func (stream *Stream) Buffer() []byte
- func (stream *Stream) Write(p []byte) (nn int, err error)
- func (stream *Stream) WriteArrayHead()
- func (stream *Stream) WriteArrayTail()
- func (stream *Stream) WriteBool(val bool)
- func (stream *Stream) WriteEmptyArray()
- func (stream *Stream) WriteFalse()
- func (stream *Stream) WriteFloat32(val float32) error
- func (stream *Stream) WriteFloat64(val float64) error
- func (stream *Stream) WriteInt(val int)
- func (stream *Stream) WriteInt16(nval int16)
- func (stream *Stream) WriteInt32(nval int32)
- func (stream *Stream) WriteInt64(nval int64)
- func (stream *Stream) WriteInt8(nval int8)
- func (stream *Stream) WriteInterface(val interface{}) bool
- func (stream *Stream) WriteMore()
- func (stream *Stream) WriteNull()
- func (stream *Stream) WriteObjectField(field string)
- func (stream *Stream) WriteObjectHead()
- func (stream *Stream) WriteObjectTail()
- func (stream *Stream) WriteRaw(s string)
- func (stream *Stream) WriteRawOrNull(s string)
- func (stream *Stream) WriteRawOrZero(s string)
- func (stream *Stream) WriteString(s string)
- func (stream *Stream) WriteStringWithHTMLEscaped(s string)
- func (stream *Stream) WriteTrue()
- func (stream *Stream) WriteUint(val uint)
- func (stream *Stream) WriteUint16(val uint16)
- func (stream *Stream) WriteUint32(val uint32)
- func (stream *Stream) WriteUint64(val uint64)
- func (stream *Stream) WriteUint8(val uint8)
- type TypeAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶
type Iterator struct { Error error // contains filtered or unexported fields }
Iterator is a io.Reader like object, with JSON specific read functions. Error is not returned as return value, but stored as Error member on this iterator instance.
func ParseBytes ¶
ParseBytes creates an Iterator instance from byte array
func (*Iterator) CurrentBuffer ¶
CurrentBuffer gets current buffer as string for debugging purpose
func (*Iterator) ReadArrayHead ¶
ReadArrayHead tells if there is array element to read, if the value is not array will be skipped
func (*Iterator) ReadArrayMore ¶
ReadArrayMore tells if there is more element to read
func (*Iterator) ReadBigFloat ¶
ReadBigFloat read big.Float
func (*Iterator) ReadBigInt ¶
ReadBigInt read big.Int
func (*Iterator) ReadBool ¶
ReadBool will assign bool to out if found, otherwise the value will be skipped
func (*Iterator) ReadFloat32 ¶
ReadFloat32 read float32
func (*Iterator) ReadFloat64 ¶
ReadFloat64 read float64
func (*Iterator) ReadInterface ¶
func (*Iterator) ReadNumber ¶
func (*Iterator) ReadObjectField ¶
ReadObjectField will return field name or empty string if not found
func (*Iterator) ReadObjectHead ¶
ReadObjectHead tells if there is object field to read
func (*Iterator) ReadObjectMore ¶
ReadObjectMore tells if there is more field to read
func (*Iterator) ReadRawMessage ¶
func (iter *Iterator) ReadRawMessage(out *RawMessage) (ret error)
func (*Iterator) ReadString ¶
ReadString will assign string to out if found, otherwise the value will be skipped
func (*Iterator) ReadUint16 ¶
ReadUint16 read uint16
func (*Iterator) ReadUint32 ¶
ReadUint32 read uint32
func (*Iterator) ReadUint64 ¶
ReadUint64 read uint64
func (*Iterator) ReportError ¶
ReportError record a error in iterator instance with current position.
type JsonAdapter ¶
type JsonAdapter struct { Unmarshal func(bytes []byte, out interface{}) error Marshal func(val interface{}) ([]byte, error) MarshalIndent func(val interface{}, prefix, indent string) ([]byte, error) }
func CreateJsonAdapter ¶
func CreateJsonAdapter(adapters ...TypeAdapter) JsonAdapter
type Number ¶
type Number string
A Number represents a JSON number literal.
type RawMessage ¶
type RawMessage []byte
type Stream ¶
type Stream struct { Error error Prefix string Indent string // contains filtered or unexported fields }
func (*Stream) Write ¶
Write writes the contents of p into the buffer. It returns the number of bytes written. If nn < len(p), it also returns an error explaining why the write is short.
func (*Stream) WriteArrayHead ¶
func (stream *Stream) WriteArrayHead()
WriteArrayHead write [ with possible indention
func (*Stream) WriteArrayTail ¶
func (stream *Stream) WriteArrayTail()
WriteArrayTail write ] with possible indention
func (*Stream) WriteFloat32 ¶
WriteFloat32 write float32 to stream
func (*Stream) WriteFloat64 ¶
WriteFloat64 write float64 to stream
func (*Stream) WriteInt16 ¶
WriteInt16 write int16 to stream
func (*Stream) WriteInt32 ¶
WriteInt32 write int32 to stream
func (*Stream) WriteInt64 ¶
WriteInt64 write int64 to stream
func (*Stream) WriteInterface ¶
func (*Stream) WriteMore ¶
func (stream *Stream) WriteMore()
WriteMore write , with possible indention
func (*Stream) WriteObjectField ¶
WriteObjectField write "field": with possible indention
func (*Stream) WriteObjectHead ¶
func (stream *Stream) WriteObjectHead()
WriteObjectHead write { with possible indention
func (*Stream) WriteObjectTail ¶
func (stream *Stream) WriteObjectTail()
WriteObjectTail write } with possible indention
func (*Stream) WriteRawOrNull ¶
func (*Stream) WriteRawOrZero ¶
func (*Stream) WriteString ¶
WriteString write string to stream without html escape
func (*Stream) WriteStringWithHTMLEscaped ¶
WriteStringWithHTMLEscaped write string to stream with html special characters escaped
func (*Stream) WriteUint16 ¶
WriteUint16 write uint16 to stream
func (*Stream) WriteUint32 ¶
WriteUint32 write uint32 to stream
func (*Stream) WriteUint64 ¶
WriteUint64 write uint64 to stream
func (*Stream) WriteUint8 ¶
WriteUint8 write uint8 to stream