output

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package output renders query results. Writers are streaming: rows are written as they arrive and nothing is held back beyond what a format needs to lay itself out.

Index

Constants

View Source
const (
	Table        = "table"
	Vertical     = "vertical"
	TSV          = "tsv"
	TSVWithNames = "tsvwithnames"
	CSV          = "csv"
	CSVWithNames = "csvwithnames"
	JSON         = "json"
	JSONLines    = "jsonlines"
	Null         = "null"
)

Output format names.

Variables

Formats lists the supported formats in display order.

Functions

func Normalize

func Normalize(name string) (string, error)

Normalize maps a user-supplied format name to a canonical one.

Types

type Column

type Column struct {
	Name string
	Type string // ClickHouse type name
}

Column describes a result column.

type TotalsWriter

type TotalsWriter interface {
	Totals(values []any) error
}

TotalsWriter is implemented by writers that can show the extra row of a WITH TOTALS query. Totals is called at most once, after the last Row and before End.

type Writer

type Writer interface {
	// Begin is called once, before the first row.
	Begin(cols []Column) error
	// Row writes one row. The values slice may be reused by the caller.
	Row(values []any) error
	// End finishes the result set and flushes buffered output.
	End() error
}

Writer renders one result set.

func New

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

New returns a writer for the given format, which must be canonical or an accepted alias (see Normalize).

Jump to

Keyboard shortcuts

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