input

package
v6.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: BSD-2-Clause Imports: 16 Imported by: 0

README

Logic for parsing disk-file/standard-input byte streams into records.

There is one record-reader type per supported input file format, and a factory method.

Documentation

Overview

Package input contains logic for parsing disk-file/standard-input byte streams into records.

Index

Constants

View Source
const CSV_BOM = "\xef\xbb\xbf"

Variables

This section is empty.

Functions

This section is empty.

Types

type BOMStrippingReader

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

BOMStrippingReader implements io.Reader to strip leading byte-order-mark characters off of CSV data.

func NewBOMStrippingReader

func NewBOMStrippingReader(underlying io.Reader) *BOMStrippingReader

func (*BOMStrippingReader) Read

func (bsr *BOMStrippingReader) Read(p []byte) (n int, err error)

type DefaultLineReader

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

func (*DefaultLineReader) Read

func (r *DefaultLineReader) Read() (string, error)

type ILineReader

type ILineReader interface {
	// Read returns the string without the final newline (or whatever terminator).
	// The error condition io.EOF as non-error "error" case.
	// EOF is always returned with empty line: the code here is structured so that
	// we do not return a non-empty line along with an EOF indicator.
	Read() (string, error)
}

func NewLineReader

func NewLineReader(handle io.Reader, irs string) ILineReader

type IRecordReader

type IRecordReader interface {
	Read(
		filenames []string,
		initialContext types.Context,
		readerChannel chan<- *list.List,
		errorChannel chan error,
		downstreamDoneChannel <-chan bool,
	)
}

func Create

func Create(readerOptions *cli.TReaderOptions, recordsPerBatch int64) (IRecordReader, error)

func NewRecordReaderMarkdown

func NewRecordReaderMarkdown(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (IRecordReader, error)

func NewRecordReaderPPRINT

func NewRecordReaderPPRINT(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (IRecordReader, error)

type JSONCommentEnabledReader

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

JSONCommentEnabledReader implements io.Reader to strip comment lines off of CSV data.

func NewJSONCommentEnabledReader

func NewJSONCommentEnabledReader(
	underlying io.Reader,
	readerOptions *cli.TReaderOptions,
	readerChannel chan<- *list.List,
) *JSONCommentEnabledReader

func (*JSONCommentEnabledReader) Read

func (bsr *JSONCommentEnabledReader) Read(p []byte) (n int, err error)

type MultiIRSLineReader

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

MultiIRSLineReader handles reading lines which may be delimited by multi-line separators, e.g. "\xe2\x90\x9e" for USV.

func (*MultiIRSLineReader) Read

func (r *MultiIRSLineReader) Read() (string, error)

type PseudoReaderGen

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

func NewPseudoReaderGen

func NewPseudoReaderGen(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*PseudoReaderGen, error)

func (*PseudoReaderGen) Read

func (reader *PseudoReaderGen) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderCSV

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

----------------------------------------------------------------

func NewRecordReaderCSV

func NewRecordReaderCSV(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderCSV, error)

func (*RecordReaderCSV) Read

func (reader *RecordReaderCSV) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderCSVLite

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

func NewRecordReaderCSVLite

func NewRecordReaderCSVLite(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderCSVLite, error)

func (*RecordReaderCSVLite) Read

func (reader *RecordReaderCSVLite) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderDKVPNIDX

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

func NewRecordReaderDKVP

func NewRecordReaderDKVP(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderDKVPNIDX, error)

func NewRecordReaderNIDX

func NewRecordReaderNIDX(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderDKVPNIDX, error)

func (*RecordReaderDKVPNIDX) Read

func (reader *RecordReaderDKVPNIDX) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderJSON

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

func NewRecordReaderJSON

func NewRecordReaderJSON(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderJSON, error)

func (*RecordReaderJSON) Read

func (reader *RecordReaderJSON) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderPprintBarredOrMarkdown

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

func (*RecordReaderPprintBarredOrMarkdown) Read

func (reader *RecordReaderPprintBarredOrMarkdown) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderTSV

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

func NewRecordReaderTSV

func NewRecordReaderTSV(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderTSV, error)

func (*RecordReaderTSV) Read

func (reader *RecordReaderTSV) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type RecordReaderXTAB

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

func NewRecordReaderXTAB

func NewRecordReaderXTAB(
	readerOptions *cli.TReaderOptions,
	recordsPerBatch int64,
) (*RecordReaderXTAB, error)

func (*RecordReaderXTAB) Read

func (reader *RecordReaderXTAB) Read(
	filenames []string,
	context types.Context,
	readerChannel chan<- *list.List,
	errorChannel chan error,
	downstreamDoneChannel <-chan bool,
)

type SingleIRSLineReader

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

SingleIRSLineReader handles reading lines with a single-character terminator.

func (*SingleIRSLineReader) Read

func (r *SingleIRSLineReader) Read() (string, error)

type WorkaroundBuffer

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

func NewWorkaroundBuffer

func NewWorkaroundBuffer() WorkaroundBuffer

func (WorkaroundBuffer) String

func (wb WorkaroundBuffer) String() string

func (WorkaroundBuffer) Write

func (wb WorkaroundBuffer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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