csvscanner

package
v0.0.0-...-4ae0600 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 11 Imported by: 0

README

This library provides a convenience wrapper for fetching remote data formatted as csv.

Library converts CSV rows to json rows and provides Bytes and Row functions, which can be used to map object into desired type.

Bytes return marshalled type map[string]string.

Row returns raw data in format []string

Warning: doesn't support files with BOM.

Documentation

Index

Constants

View Source
const BOMUTF16BE string = "feff"
View Source
const BOMUTF16LE string = "fffe"
View Source
const BOMUTF32BE string = "0000feff"
View Source
const BOMUTF32LE string = "fffe0000"
View Source
const BOMUTF8 string = "efbbbf"

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVScanner

type CSVScanner struct {
	ColumnNames []string
	// contains filtered or unexported fields
}

func NewCSVScanner

func NewCSVScanner(reader io.ReadCloser) (*CSVScanner, error)

func NewURLScanner

func NewURLScanner(ctx context.Context, httpClient *http.Client, url string) (*CSVScanner, error)

func (*CSVScanner) Bytes

func (cs *CSVScanner) Bytes() []byte

func (*CSVScanner) Close

func (cs *CSVScanner) Close() error

func (*CSVScanner) Err

func (cs *CSVScanner) Err() error

err returns the first non-EOF error that was encountered by the CSVScanner

func (*CSVScanner) Row

func (cs *CSVScanner) Row() []string

func (*CSVScanner) Scan

func (cs *CSVScanner) Scan() bool

func (*CSVScanner) Unmarshal

func (cs *CSVScanner) Unmarshal(t interface{})

Jump to

Keyboard shortcuts

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