jsonstream

package
v0.3.0-pre9 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package jsonstream implements streaming reader and writer for JSON objects.

Index

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
}

Reader reads a stream of JSON objects.

func NewReader

func NewReader(r io.Reader, header string, summary interface{}) (*Reader, error)

NewReader returns new Reader on top of a given buffered reader. The provided header must match the beginning of a stream.

func (*Reader) Read

func (r *Reader) Read(v interface{}) error

Read reads the next JSON objects from the stream, returns io.EOF on the end of stream.

type Writer

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

Writer writes a stream of JSON objects.

func NewWriter

func NewWriter(w io.Writer, header string) *Writer

NewWriter creates a new Writer on top of a specified writer with a specified optional header.

func (*Writer) Finalize

func (w *Writer) Finalize() error

Finalize writes the postamble to the JSON stream.

func (*Writer) FinalizeWithSummary

func (w *Writer) FinalizeWithSummary(summary interface{}) error

FinalizeWithSummary writes the postamble to the JSON stream with a given summary object.

func (*Writer) Write

func (w *Writer) Write(v interface{}) error

Write JSON object to the output.

Jump to

Keyboard shortcuts

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