codec

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonArrayCodecId  = "json-array"
	JsonStreamcodecId = "json-stream"
	TextCodecId       = "text"
)

Variables

This section is empty.

Functions

func IsValidCodec

func IsValidCodec(codec string) bool

func ValidCodecs

func ValidCodecs() []string

Types

type BufioCodec

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

BufioCodec is a basic codec that reads a file line by line and reports the contents line number and which file the line came from

func (*BufioCodec) Err

func (codec *BufioCodec) Err() error

func (*BufioCodec) Next

func (codec *BufioCodec) Next() bool

func (*BufioCodec) Value

func (codec *BufioCodec) Value() common.MapStr

type Codec

type Codec interface {

	// Next moves the cursor to the next line of input
	Next() bool

	// Gets the properties for the current line of input
	Value() common.MapStr

	// Err returns the error that caused the Codec to stop if it terminated
	// before the stream was completed.
	Err() error
}

func NewBufioCodec

func NewBufioCodec(path string, input io.Reader) Codec

func NewCodec

func NewCodec(codec, filename string, reader io.Reader) (Codec, error)

func NewJsonArrayCodec

func NewJsonArrayCodec(path string, input io.Reader) Codec

func NewJsonStreamCodec

func NewJsonStreamCodec(path string, input io.Reader) Codec

type JsonArrayCodec

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

JsonArrayCodec iterates over a serialized JSON array of objects

Inspiration for this decoding technique taken from go's JSON documentation https://golang.org/pkg/encoding/json/#Decoder.Decode

func (*JsonArrayCodec) Err

func (codec *JsonArrayCodec) Err() error

func (*JsonArrayCodec) Next

func (codec *JsonArrayCodec) Next() bool

func (*JsonArrayCodec) Value

func (codec *JsonArrayCodec) Value() common.MapStr

type JsonObject

type JsonObject map[string]interface{}

type JsonStreamCodec

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

func (*JsonStreamCodec) Err

func (codec *JsonStreamCodec) Err() error

func (*JsonStreamCodec) Next

func (codec *JsonStreamCodec) Next() bool

func (*JsonStreamCodec) Value

func (codec *JsonStreamCodec) Value() common.MapStr

Jump to

Keyboard shortcuts

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