Documentation ¶
Index ¶
- type Option
- func Comma(comma rune) Option
- func Comment(comment rune) Option
- func ContinueOnError(continue_ bool) Option
- func FieldsPerRecord(fields int) Option
- func LazyQuotes(lazy bool) Option
- func ReuseRecord(reuse bool) Option
- func SkipHeaderRecord() Option
- func SkipRecords(count int) Option
- func TrimLeadingSpace(trim bool) Option
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Scanner)
Option is a func type received by NewScanner. Each one allows configuration of the scanner and/or its internal *csv.Reader.
func ContinueOnError ¶
ContinueOnError controls scanner behavior in error scenarios. If true is passed, continue scanning until io.EOF is reached. If false is passed (default), any error encountered during scanning will result in the next call to Scan returning false and the Scanner may be considered dead. See Scanner.Error() for the exact error (before the next call to Scanner.Scan()). See https://golang.org/pkg/encoding/csv/#pkg-variables and https://golang.org/pkg/encoding/csv/#ParseError for more information regarding possible error values.
func FieldsPerRecord ¶
func LazyQuotes ¶
func ReuseRecord ¶
func SkipHeaderRecord ¶
func SkipHeaderRecord() Option
func SkipRecords ¶
func TrimLeadingSpace ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner wraps a csv.Reader via an API similar to that of bufio.Scanner.
func NewScanner ¶
NewScanner returns a scanner configured with the provided options.
func (*Scanner) Error ¶
Error returns the last non-nil error produced by Scan (if there was one). It will not ever return io.EOF. This method may be called at any point during or after scanning but the underlying err will be reset by each call to Scan.
func (*Scanner) Record ¶
Record returns the most recent record generated by a call to Scan as a []string. See *csv.Reader.ReuseRecord for details on the strategy for reusing the underlying array: https://golang.org/pkg/encoding/csv/#Reader
func (*Scanner) Scan ¶
Scan advances the Scanner to the next record, which will then be available through the Record method. It returns false when the scan stops, either by reaching the end of the input or an error. After Scan returns false, the Error method will return any error that occurred during scanning, except that if it was io.EOF, Error will return nil.