Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrStop can be returned from a JSONCallback function to signal that processing should stop // at this object ErrStop = errors.New("stop processing json") )
Functions ¶
func Reader ¶
func Reader(reader io.Reader, callback JSONCallback) (err error)
Reader reads all JSON objects from the input and calls callback for each of them. If callback returns an error, Reader will stop processing and return the error. If the returned error is ErrStop, Reader will return nil instead of the error.
func ReaderObjects ¶
func ReaderObjects(reader io.Reader) (objects []json.RawMessage, err error)
ReaderObjects takes the given io.Reader and reads all possible JSON objects it can find in it. Assumes the stream to consist of utf8 bytes
Types ¶
type JSONCallback ¶
JSONCallback is the callback function passed to Reader. Found JSON objects will be passed to it as bytes. If this function returns an error, processing will stop and return that error. If the returned error is ErrStop, processing will stop without an error.
Click to show internal directories.
Click to hide internal directories.
