render

package
v1.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FormatTable = "table"
	FormatTSV   = "tsv"
	FormatCSV   = "csv"
	FormatJSON  = "json"
)

FormatTable, FormatTSV, FormatCSV, FormatJSON are the supported --mode values.

Variables

This section is empty.

Functions

func Render

func Render(out io.Writer, r Result, format string, headers bool) error

Render writes the result to out in the named format. An empty format string auto-detects (table when out is a terminal, TSV otherwise). The headers argument suppresses the header row for the row-shaped formats (table, tsv, csv); JSON ignores it since object keys carry the column names regardless.

func WriteTableBody

func WriteTableBody(out io.Writer, cols []string, rows []map[string]any) error

WriteTableBody renders the header + separator + data rows, but no footer. Used by write previews; always shows the header (previews are a labeled snapshot, not a result set the user has flagged headerless).

Types

type Result

type Result struct {
	Columns []string
	Rows    []map[string]any
}

Result is a column-ordered tabular result ready for rendering. Cells hold the raw values returned by Graph (string, float64, bool, nil, ...) so the JSON renderer can preserve types; the table, TSV, and CSV renderers stringify on the way out.

Jump to

Keyboard shortcuts

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