Documentation ¶
Overview ¶
Package csv implements the sq driver for CSV/TSV et al.
Index ¶
- Constants
- Variables
- func DetectCSV(ctx context.Context, openFn source.FileOpenFunc) (detected source.DriverType, score float32, err error)
- func DetectTSV(ctx context.Context, openFn source.FileOpenFunc) (detected source.DriverType, score float32, err error)
- func Hash(detectors []*kind.Detector) (h string, err error)
- func NamedDelims() []string
- type Provider
Constants ¶
View Source
const ( // TypeCSV is the CSV driver type. TypeCSV = source.DriverType("csv") // TypeTSV is the TSV driver type. TypeTSV = source.DriverType("tsv") )
Variables ¶
View Source
var OptDelim = options.NewString(
"driver.csv.delim",
0,
delimCommaKey,
"Delimiter for ingest CSV data",
`Delimiter to use for CSV files. Default is "comma".
Possible values are: comma, space, pipe, tab, colon, semi, period.`,
"source",
"csv",
)
OptDelim specifies the CSV delimiter to use.
View Source
var OptEmptyAsNull = options.NewBool( "driver.csv.empty-as-null", 0, 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.`, "source", "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, openFn source.FileOpenFunc) (detected source.DriverType, score float32, err error, )
DetectCSV implements source.DriverDetectFunc.
func DetectTSV ¶
func DetectTSV(ctx context.Context, openFn source.FileOpenFunc) (detected source.DriverType, score float32, err error, )
DetectTSV implements source.DriverDetectFunc.
func Hash ¶ added in v0.32.0
Hash generates a hash from the kinds returned by the detectors. The detectors should already have sampled data.
TODO: move Hash to pkg libsq/core/kind?
func NamedDelims ¶ added in v0.34.0
func NamedDelims() []string
NamedDelims returns the named delimiters, such as [comma, tab, pipe...].
Types ¶
Click to show internal directories.
Click to hide internal directories.