csvp

package
v0.0.0-...-5204ab8 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 5 Imported by: 1

README

csvp

-- import "github.com/cmcoffee/snugforge/csvp"

Usage

func IsReadError
func IsReadError(err error) bool

IsReadError reports whether err is a row read error. It checks if the error is of type rowReadError.

func IsRowError
func IsRowError(err error) bool

IsRowError checks if an error is a rowProcessError. It returns true if the error is of type rowProcessError, otherwise it returns false.

type CSVReader
type CSVReader struct {
	Processor    func(row []string) (err error)                     // Callback funcction for each row read.
	ErrorHandler func(line int, row string, err error) (abort bool) // ErrorHandler when problem reading CSV or processing CSV.
}

CSVReader processes CSV data row by row.

func NewReader
func NewReader() *CSVReader

NewReader creates and returns a new CSVReader instance.

func (*CSVReader) Read
func (T *CSVReader) Read(reader io.Reader)

Read reads a CSV from the provided reader, processing each row. It skips lines starting with '#'.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsReadError

func IsReadError(err error) bool

IsReadError reports whether err is a row read error. It checks if the error is of type rowReadError.

func IsRowError

func IsRowError(err error) bool

IsRowError checks if an error is a rowProcessError. It returns true if the error is of type rowProcessError, otherwise it returns false.

Types

type CSVReader

type CSVReader struct {
	Processor    func(row []string) (err error)                     // Callback funcction for each row read.
	ErrorHandler func(line int, row string, err error) (abort bool) // ErrorHandler when problem reading CSV or processing CSV.
}

CSVReader processes CSV data row by row.

func NewReader

func NewReader() *CSVReader

NewReader creates and returns a new CSVReader instance.

func (*CSVReader) Read

func (T *CSVReader) Read(reader io.Reader)

Read reads a CSV from the provided reader, processing each row. It skips lines starting with '#'.

Jump to

Keyboard shortcuts

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