csv

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package csv implements the sq driver for CSV/TSV et al.

Index

Constants

This section is empty.

Variables

View Source
var OptDelim = options.NewString(
	"driver.csv.delim",
	nil,
	delimCommaKey,
	nil,
	"Delimiter for ingest CSV data",
	`Delimiter to use for CSV files. Default is "comma".
Possible values are: comma, space, pipe, tab, colon, semi, period.`,
	options.TagSource,
	options.TagIngestMutate,
	"csv",
)

OptDelim specifies the CSV delimiter to use.

View Source
var OptEmptyAsNull = options.NewBool(
	"driver.csv.empty-as-null",
	nil,
	true,
	"Treat ingest empty CSV fields as NULL",
	`When true, empty CSV fields are treated as NULL. When false,
the zero value for that type is used, e.g. empty string or 0.`,
	options.TagSource,
	options.TagIngestMutate,
	"csv",
)

OptEmptyAsNull determines if an empty CSV field is treated as NULL or as the zero value for the kind of that field.

Functions

func DetectCSV

func DetectCSV(ctx context.Context, newRdrFn files.NewReaderFunc) (detected drivertype.Type, score float32,
	err error,
)

DetectCSV implements files.TypeDetectFunc.

func DetectTSV

func DetectTSV(ctx context.Context, newRdrFn files.NewReaderFunc) (detected drivertype.Type,
	score float32, err error,
)

DetectTSV implements files.TypeDetectFunc.

func NamedDelims added in v0.34.0

func NamedDelims() []string

NamedDelims returns the named delimiters, such as [comma, tab, pipe...].

Types

type Provider

type Provider struct {
	Log      *slog.Logger
	Ingester driver.GripOpenIngester
	Files    *files.Files
}

Provider implements driver.Provider.

func (*Provider) DriverFor

func (d *Provider) DriverFor(typ drivertype.Type) (driver.Driver, error)

DriverFor implements driver.Provider.

Jump to

Keyboard shortcuts

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