Documentation
¶
Overview ¶
Package encoding handles the encoding process for CSV, TSV, and fixed length text.
Package encoding handles the encoding process for CSV, TSV, and fixed length text.
Package encoding handles the encoding process for CSV, TSV, and fixed length text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CsvEncoderOptions ¶
type CsvEncoderOptions struct { // Charset is an output character code (default: charset.UTF8) Charset charset.Charset // Separator default: ',' Separator rune // OmitHeader is whether to skip generating the header on the first line from the field from the structure definition OmitHeader bool // Newline default: LF Newline newline.Newline }
CsvEncoderOptions is an optional argument to NewCsvEncoder.
type Encoder ¶
type Encoder[TRow any] interface { // Encode encodes and writes arguments. Encode(row TRow) error // Flush flushes data. Call this before the end of processing. Flush() error }
Encoder handles the encoding of CSV, TSV, JSON, and fixed length text.
func NewCsvEncoder ¶
func NewCsvEncoder[TRow any](dst io.Writer, opts CsvEncoderOptions) Encoder[TRow]
NewCsvEncoder creates an Encoder that processes CSV/TSV. See csvutil documentation for structure tags: https://github.com/jszwec/csvutil
func NewFixedWidthWriter ¶
func NewFixedWidthWriter[TRow any](dst io.Writer, opts FixedWidthEncoderOptions) Encoder[TRow]
NewFixedWidthWriter creates an Encoder that generates a fixed length field. See csvutil documentation for structure tags: https://github.com/ianlopshire/go-fixedwidth