go/src/encoding/csv/reader.go

type ParseError

func (e *ParseError) Error() string {}

func (e *ParseError) Unwrap() error {}

var ErrBareQuote

var ErrQuote

var ErrFieldCount

var ErrTrailingComma

var errInvalidDelim

func validDelim(r rune) bool {}

type Reader

// NewReader returns a new Reader that reads from r.
func NewReader(r io.Reader) *Reader {}

// Read reads one record (a slice of fields) from r.
// If the record has an unexpected number of fields,
// Read returns the record along with the error [ErrFieldCount].
// If the record contains a field that cannot be parsed,
// Read returns a partial record along with the parse error.
// The partial record contains all fields read before the error.
// If there is no data left to be read, Read returns nil, [io.EOF].
// If [Reader.ReuseRecord] is true, the returned slice may be shared
// between multiple calls to Read.
func (r *Reader) Read() (record []string, err error) {}

// FieldPos returns the line and column corresponding to
// the start of the field with the given index in the slice most recently
// returned by [Reader.Read]. Numbering of lines and columns starts at 1;
// columns are counted in bytes, not runes.
//
// If this is called with an out-of-bounds index, it panics.
func (r *Reader) FieldPos(field int) (line, column int) {}

// InputOffset returns the input stream byte offset of the current reader
// position. The offset gives the location of the end of the most recently
// read row and the beginning of the next row.
func (r *Reader) InputOffset() int64 {}

type position

// ReadAll reads all the remaining records from r.
// Each record is a slice of fields.
// A successful call returns err == nil, not err == [io.EOF]. Because ReadAll is
// defined to read until EOF, it does not treat end of file as an error to be
// reported.
func (r *Reader) ReadAll() (records [][]string, err error) {}

// readLine reads the next line (with the trailing endline).
// If EOF is hit without a trailing endline, it will be omitted.
// If some bytes were read, then the error is never [io.EOF].
// The result is only valid until the next call to readLine.
func (r *Reader) readLine() ([]byte, error) {}

// lengthNL reports the number of bytes for the trailing \n.
func lengthNL(b []byte) int {}

// nextRune returns the next rune in b or utf8.RuneError.
func nextRune(b []byte) rune {}

func (r *Reader) readRecord(dst []string) ([]string, error) {}