Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyFirstLine = fmt.Errorf("empty first line")
View Source
var ErrFileMissing = errors.New("provide valid input file path")
View Source
var ErrNoHeaders = errors.New("provide headers manually")
View Source
var ErrNoHeadersOrColSep = errors.New("provide headers and/or delimiter manually")
View Source
var ErrNoInputOrOutput = errors.New("no input or output provided")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path to the CSV file.
Path string
// Writer can be used for writing output instead of file.
Writer io.Writer
// Headers are the names of fields in the CSV file.
Headers []string
// SkipHeaders
SkipHeaders bool
// ColSep is the delimiter character used in the CSV file.
ColSep rune
// FieldsNum is the expected number of fields in each row.
FieldsNum int
// BadRowMode specifies how to handle rows with an incorrect
// number of fields. Options include processing, ignoring, or
// raising an error (default).
BadRowMode gnfmt.BadRow
// WithQuotes is true if `"` is used when need arises to
// protect field separators, new lines inside a field.
WithQuotes bool
}
Config provides settings for processing CSV data, including file path, headers, delimiter, field count, and bad row handling mode.
type Option ¶
type Option func(*Config)
Option is a function that modifies a Config.
func OptBadRowMode ¶
OptBadRowMode sets the BadRowMode field of the Config.
func OptFieldsNum ¶
OptFieldsNum sets the FieldsNum field of the Config.
func OptHeaders ¶
OptHeaders sets the Headers field of the Config.
func OptSkipHeaders ¶ added in v0.5.6
OptSkipHeaders sets OptSkipHeaders field of the config.
func OptWithQuotes ¶ added in v0.5.3
OptWithQuotes sets WithQuotes field of the Config.
Click to show internal directories.
Click to hide internal directories.