jsonlines

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package json lines mimicks standard library json Encoder and Decoder, but to encode and decode one JSON per line.

Index

Constants

View Source
const (
	// DefaultBufferSize is the default buffer size for decoding. It will
	// be used whenever the given reader is not buffered.
	DefaultBufferSize = 1024 * 1024 * 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	// Decode decodes the next JSON line into the given value.
	Decode(interface{}) error
}

Decoder decodes JSON lines.

func NewDecoder

func NewDecoder(r io.Reader) Decoder

NewDecoder creates a new decoder with the given reader. If the given reader is not buffered, it will be wrapped with a *bufio.Reader.

type Encoder

type Encoder interface {
	// Encode encodes the next value into a JSON line.
	Encode(interface{}) error
}

Encoder encodes JSON lines.

func NewEncoder

func NewEncoder(w io.Writer) Encoder

NewEncoder creates a new encoder using the given writer.

Jump to

Keyboard shortcuts

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