ent

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRow added in v0.3.0

type BadRow int

BadRow type describes different scenarios of processing rows with wrong number of fields.

const (
	// ProcessBadRow means processing bad row hoping for the best.
	ProcessBadRow BadRow = iota

	// SkipBadRow means that rows with wrong number of fields will not be
	// processed.
	SkipBadRow

	// ErrorBadRow means that an error will be returned when a row with wrong
	// number of fields is encountered.
	ErrorBadRow
)

type CSVAttr

type CSVAttr struct {
	// Headers contains names of fields to be placed to CSV file during
	// creation of DwC Archive.
	Headers []string

	// Path is the path to the CSV file.
	Path string

	// ColSep is the UTF-8 character used to separate fields from each other.
	ColSep rune

	// Quote (usually `"`) that escapes ColSep characters withing the fields.
	Quote string

	// IgnoreHeader indicates if there is a header row in the CSV file.
	// If header exists, its values will be ignored.
	IgnoreHeader string

	// BadRowProcessing determines a method for dealing with rows that have
	// wrong number of elements. The 'bad rows' would either be processed,
	// ignored, of break the execution of the program. Default is to raise an
	// error.
	BadRowProcessing BadRow
}

CSVAttr describes a variety of configuration attributes for reading and writing CSV files.

type CSVReader

type CSVReader interface {
	ReadSlice(offset, limit int) ([][]string, error)
	Read(context.Context, chan<- []string) (int, error)
	Close() error
}

type CSVWriter

type CSVWriter interface {
	Write(ctx context.Context, ch <-chan []string) error
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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