Documentation
¶
Index ¶
- Variables
- func Any(in []byte, pos int) (int, error)
- func Array(in []byte, pos int) (int, error)
- func AsArray(in []byte, pos int) ([][]byte, error)
- func Boolean(in []byte, pos int) (int, error)
- func Expect(in []byte, pos int, content ...byte) (int, error)
- func FindIndex(in []byte, pos, index int) ([]byte, error)
- func FindKey(in []byte, pos int, k []byte) ([]byte, error)
- func FindRange(in []byte, pos, from, to int) ([]byte, error)
- func Match(data, pattern []byte, expected int) bool
- func NewError(pos int, b byte) error
- func Null(in []byte, pos int) (int, error)
- func Number(in []byte, pos int) (int, error)
- func Object(in []byte, pos int) (int, error)
- func SkipSpace(in []byte, pos int) (int, error)
- func String(in []byte, pos int) (int, error)
- type LineReader
- func (lr *LineReader) Read(ptr interface{}) error
- func (lr *LineReader) ReadAll(v interface{}) (int, error)
- func (lr *LineReader) ReadAllMatch(pattern string, v interface{}) (int, error)
- func (lr *LineReader) ReadAllRaw() ([][]byte, error)
- func (lr *LineReader) ReadAllRawMatch(pattern string) ([][]byte, error)
- func (lr *LineReader) ReadRaw() ([]byte, error)
- type LineWriter
- type OpErr
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnexpectedEOF = errors.New("unexpected EOF") ErrKeyNotFound = errors.New("key not found") ErrIndexOutOfBounds = errors.New("index out of bounds") ErrToLessThanFrom = errors.New("to index less than from index") ErrUnexpectedValue = errors.New("unexpected value") )
var ( ErrPtrRequired = errors.New("pointer required") ErrPtrToSliceRequired = errors.New("pointer is not pointing to a slice") )
Functions ¶
func Any ¶
Any returns the position of the end of the current element that begins at pos; handles any valid json element
func Array ¶
Array returns the position of the end of the array that begins at the position specified
func AsArray ¶
AsArray accepts an []byte encoded json array as an input and returns the array's elements
func FindIndex ¶
FindIndex accepts a JSON array and return the value of the element at the specified index
func FindKey ¶
FindKey accepts a JSON object and returns the value associated with the key specified
Types ¶
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader reads one complete JSON document from each line.
func NewLineReader ¶
func NewLineReader(r io.Reader) *LineReader
NewLineReader returns a reader that reads newline delimited JSON documents.
func (*LineReader) Read ¶
func (lr *LineReader) Read(ptr interface{}) error
Decode decodes the next JSON document from the reader. It will return an error of io.EOF when the end of the file or stream is reached. The reader can continue to read lines even if the previous line returned and error (as long as the error is not io.EOF of course.)
func (*LineReader) ReadAll ¶
func (lr *LineReader) ReadAll(v interface{}) (int, error)
ReadAll reads and unmarshalls all the json entries
func (*LineReader) ReadAllMatch ¶
func (lr *LineReader) ReadAllMatch(pattern string, v interface{}) (int, error)
ReadAllMatch reads and unmarshalls all the json entries that match the provided patter
func (*LineReader) ReadAllRaw ¶
func (lr *LineReader) ReadAllRaw() ([][]byte, error)
func (*LineReader) ReadAllRawMatch ¶
func (lr *LineReader) ReadAllRawMatch(pattern string) ([][]byte, error)
func (*LineReader) ReadRaw ¶
func (lr *LineReader) ReadRaw() ([]byte, error)
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
func NewLineWriter ¶
func NewLineWriter(w io.Writer) *LineWriter
func (*LineWriter) Write ¶
func (lw *LineWriter) Write(v interface{}) (int, error)
Write writes data as a JSON document followed by a newline delimiter.