csv

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrInvalidHeader

func IsErrInvalidHeader(err error) bool

IsErrInvalidHeader checks if the `err` is of ErrInvalidHeader type.

func NewCSVFileFormat

func NewCSVFileFormat(schemaName string) fileformat.FileFormat

NewCSVFileFormat creates a FileFormat for CSV.

func NewReader

func NewReader(inputName string, r io.Reader, decl *FileDecl, xpathStr string) (*reader, error)

NewReader creates an FormatReader for CSV file format.

Types

type Column added in v0.0.4

type Column struct {
	Name string `json:"name"`
	// If the CSV column 'name' contains characters (such as space, or special letters) that are
	// not suitable for *idr.Node construction and xpath query, this gives schema writer an
	// alternate way to name/label the column. Optional.
	Alias *string `json:"alias"`
}

Column is a CSV column.

type ErrInvalidHeader

type ErrInvalidHeader string

ErrInvalidHeader indicates the header of the CSV input is corrupted, mismatched, or simply unreadable. This is a fatal, non-continuable error.

func (ErrInvalidHeader) Error

func (e ErrInvalidHeader) Error() string

type FileDecl added in v0.0.4

type FileDecl struct {
	Delimiter           string   `json:"delimiter"`
	ReplaceDoubleQuotes bool     `json:"replace_double_quotes"`
	HeaderRowIndex      *int     `json:"header_row_index"`
	DataRowIndex        int      `json:"data_row_index"`
	Columns             []Column `json:"columns"`
}

FileDecl describes CSV specific schema settings for omniparser reader.

Jump to

Keyboard shortcuts

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