Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
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 keep processing input until it receives EOF from Reader. Run fails on any error including Reader error, Writer error and Processor error. If an error is encountered the writer operation will be attampted anyway so that the output is left in consistent state, recording what has been actually done by Processor.
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.
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