Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CSVReader ¶
type CSVReader struct {
// contains filtered or unexported fields
}
func NewCSVReader ¶
CSV creates csv.Reader reading from filename.
type CSVWriter ¶
type CSVWriter struct {
// contains filtered or unexported fields
}
func NewCSVWriter ¶
CSV creates csv.Writer writing to underlying file. Do not forget to call Close method once you are done.
type MemReader ¶
type MemReader struct {
// contains filtered or unexported fields
}
func NewMemReader ¶
type MemWriter ¶
type MemWriter struct {
// contains filtered or unexported fields
}
func NewMemWriter ¶
func NewMemWriter() *MemWriter
type Processor ¶
Processor accepts string slice, does what it should and returns output. Non-nil error returned by Processor stops further processing.
func ChainProcessor ¶ added in v0.3.0
Chain chains provided Processors. When an error is returned by a Processor in chain, processing stops and the error is retuned without running further stages.
type RunResult ¶ added in v0.2.0
type RunResult struct {
Read int // number of records read without error (offset count not included)
Processed int // number of records processed without error
Written int // number of records written to Writer without error
}
func Run ¶
Run starts the script described by r. First Read is called offset times with output of Read being discarded. Then limit Reads are made and processor is called for each portion of data. If limit is 0 then Run keeps processing input until it receives EOF from Reader. Run fails on any error including Reader error, Writer error and Processor error. The returned RunResult is AWAYS VALID and indicates the actual progress of script. Returned error explains why Run failed. It may be either read, process or write error.
type StdinReader ¶
type StdinReader struct {
// contains filtered or unexported fields
}
StdinReader reads from stdin
func NewStdinReader ¶
func NewStdinReader() *StdinReader
func (*StdinReader) Read ¶
func (s *StdinReader) Read() ([]string, error)
Read reads from stdin until \n character then splits result at "," separator and returns the resulting slice. It returns EOF when nothing left to read.
type StdoutWriter ¶
type StdoutWriter struct{}
func NewStdoutWriter ¶
func NewStdoutWriter() *StdoutWriter
func (*StdoutWriter) Write ¶
func (s *StdoutWriter) Write(in []string) error