csv

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Import

func Import(name, path string, opt ...Option) (*datatable.DataTable, error)

Import a csv

Types

type Option

type Option func(*Options)

Option is a setter

func AcceptDate

func AcceptDate(v string) Option

AcceptDate to accept a specific date format

func ColumnNames

func ColumnNames(v ...string) Option

ColumnNames defines the column name

func ColumnTypes

func ColumnTypes(v ...datatable.ColumnType) Option

ColumnTypes defines the column type

func Comma

func Comma(v rune) Option

Comma is the field delimiter Default to ','

func Comment

func Comment(v rune) Option

Comment if not 0, is the comment character. Lines beginning with the Comment character without preceding whitespace are ignored.

func HasHeader

func HasHeader(v bool) Option

HasHeader to retrieve column names on line #1

func IgnoreLineWithError

func IgnoreLineWithError(v bool) Option

IgnoreLineWithError to not stop the reading process if a line has an error

func LazyQuotes

func LazyQuotes(v bool) Option

LazyQuotes is true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field.

func TrimLeadingSpace

func TrimLeadingSpace(v bool) Option

TrimLeadingSpace is true, leading white space in a field is ignored. This is done even if the field delimiter, Comma, is white space.

type Options

type Options struct {
	HasHeaders            bool
	ColumnNames           []string               // if len == 0 => take headers else "col #i"
	ColumnTypes           []datatable.ColumnType // if len == 0 => detection
	IgnoreIfReadLineError bool
	Comma                 rune
	Comment               rune
	LazyQuotes            bool
	TrimLeadingSpace      bool
	DateFormats           []string
}

Options are options to import a csv

Jump to

Keyboard shortcuts

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