interfaces

package
v0.0.0-...-06663e1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Interfaces shared among go-csv and the Go standard library's encoding/csv. Can be used to easily use go-csv as a drop-in replacement for the latter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader interface {
	// Read reads one record from r. The record is a slice of strings with each
	// string representing one field.
	Read() (record []string, err error)

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

A helper interface for a general CSV reader. Conforms to encoding/csv Reader in the standard Go library as well as the Reader implemented by go-csv.

type Writer

type Writer interface {
	// Error reports any error that has occurred during a previous Write or
	// Flush.
	Error() error

	// Flush writes any buffered data to the underlying io.Writer.
	// To check if an error occurred during the Flush, call Error.
	Flush()

	// Writer writes a single CSV record to w along with any necessary quoting.
	// A record is a slice of strings with each string being one field.
	Write(record []string) error

	// WriteAll writes multiple CSV records to w using Write and then calls Flush.
	WriteAll(records [][]string) error
}

A helper interface for a general CSV writer. Conforms to encoding/csv Writer in the standard go library as well as the Writer implemented by this package.

Jump to

Keyboard shortcuts

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