fromcsv

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrCSV marks a CSV parse failure.
	ErrCSV errs.Const = "csv"
	// ErrJSON marks a JSON encoding failure.
	ErrJSON errs.Const = "json"
)

The package's error vocabulary: errs.Const sentinels matched with errors.Is.

View Source
const (
	FromCSVWithHeader    fromCSVNoHeader   = false
	FromCSVWithoutHeader fromCSVNoHeader   = true
	FromCSVNoTrim        fromCSVTrimSpaces = false
	FromCSVTrim          fromCSVTrimSpaces = true
)

Variables

This section is empty.

Functions

func FromCsv

func FromCsv(opts ...any) gloo.Command[[]byte, []byte]

FromCsv returns a command that converts CSV input into newline-delimited JSON: each row becomes one compact JSON object keyed by the column headers.

Flags:

  • Delimiter(r): field delimiter (default ',')
  • FromCSVWithoutHeader: treat every row as data and synthesize col1, col2…
  • FromCSVTrim: trim leading whitespace in each field

Input is buffered so the CSV reader can honor quoted fields that span lines.

Types

type Delimiter

type Delimiter rune

Delimiter is the CSV field delimiter (default ',').

Jump to

Keyboard shortcuts

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