csv

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format uint

Format is the format of the data in the CSV file.

const (
	// RowIDColumnID formatted data is ROW_ID,COLUMN_ID.
	RowIDColumnID Format = iota
	// RowIDColumnKey formatted data is ROW_ID,COLUMN_KEY.
	RowIDColumnKey
	// RowKeyColumnID formatted data is ROW_KEY,COLUMN_ID.
	RowKeyColumnID
	// RowKeyColumnKey formatted data is ROW_KEY,COLUMN_ID.
	RowKeyColumnKey
	// ColumnID formatted data is COLUMN_ID. Valid only for value import.
	ColumnID
	// ColumnKey formatted data is COLUMN_KEY. Valud only for value import.
	ColumnKey
)

type Iterator

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

Iterator reads records from a Reader. Each line should contain a single record in the following form: field1,field2,...

func NewColumnIterator

func NewColumnIterator(format Format, reader io.Reader) *Iterator

NewColumnIterator creates a new iterator for column data.

func NewColumnIteratorWithTimestampFormat

func NewColumnIteratorWithTimestampFormat(format Format, reader io.Reader, timestampFormat string) *Iterator

NewColumnIteratorWithTimestampFormat creates a new iterator for column data with timestamp.

func NewIterator

func NewIterator(reader io.Reader, unmarshaller RecordUnmarshaller) *Iterator

NewIterator creates a CSVIterator from a Reader.

func NewValueIterator

func NewValueIterator(format Format, reader io.Reader) *Iterator

NewValueIterator creates a new iterator for value data.

func (*Iterator) NextRecord

func (c *Iterator) NextRecord() (pilosa.Record, error)

NextRecord iterates on lines of a Reader. Returns io.EOF on end of iteration.

type RecordUnmarshaller

type RecordUnmarshaller func(text string) (pilosa.Record, error)

RecordUnmarshaller is a function which creates a Record from a CSV file line with column data.

func ColumnUnmarshaller

func ColumnUnmarshaller(format Format) RecordUnmarshaller

ColumnUnmarshaller creates a RecordUnmarshaller for importing columns with the given format.

func ColumnUnmarshallerWithTimestamp

func ColumnUnmarshallerWithTimestamp(format Format, timestampFormat string) RecordUnmarshaller

ColumnUnmarshallerWithTimestamp creates a RecordUnmarshaller for importing columns with the given format and timestamp format.

func FieldValueUnmarshaller

func FieldValueUnmarshaller(format Format) RecordUnmarshaller

FieldValueUnmarshaller is a function which creates a Record from a CSV file line with value data.

Jump to

Keyboard shortcuts

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