sink

package
v0.0.0-...-f73e591 Latest Latest
Warning

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

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

Documentation

Overview

CSV rendering (RFC 4180 via encoding/csv).

JSON Lines rendering: one object per row, keys in column order.

Package sink renders decoded rows as CSV or JSON Lines.

Sinks are lazy about columns: when a dump carries no column names (a bare `INSERT INTO t VALUES …` with no CREATE TABLE in the file), names c1…cN are synthesized from the width of the first row.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Columns are the output column names; nil synthesizes c1…cN.
	Columns []string
	// NullRepr is the CSV spelling of SQL NULL (default: empty string).
	NullRepr string
	// NoHeader suppresses the CSV header row.
	NoHeader bool
}

Options configure rendering shared by all formats.

type Sink

type Sink interface {
	// Row writes one row. Implementations must tolerate rows wider or
	// narrower than the column list.
	Row(vals []parse.Value) error
	// Close flushes buffered output. It does not close the underlying
	// writer.
	Close() error
}

Sink consumes decoded rows for one table.

func New

func New(format string, w io.Writer, opts Options) (Sink, error)

New builds a sink for format ("csv" or "jsonl") writing to w.

Jump to

Keyboard shortcuts

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