Documentation
¶
Overview ¶
Package asciitable renders caller-owned rows as ASCII tables.
It is intentionally independent of Spanner plan protobufs and plantree types: callers build rows from their own plan model, then provide column definitions and predicate accessors for the cells they want to show.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderAppendix ¶
func RenderAppendix[T any](rows []T, spec AppendixSpec[T]) (string, error)
RenderAppendix formats an appendix for rows with associated items.
Types ¶
type Alignment ¶
type Alignment string
Alignment controls horizontal alignment for a rendered column. The zero value means AlignLeft.
type AppendixSpec ¶
type AppendixSpec[T any] struct { // Title is printed before item lines. It must be non-empty. Title string // ID returns the non-negative display ID used in the appendix. ID func(row T) uint // Items returns the item lines associated with the row. Items func(row T) []string }
AppendixSpec defines how appendices read row IDs and item lines.
type Column ¶
type Column[T any] struct { // Header is the column header text. Header string // Alignment controls the cell alignment. The zero value uses [AlignLeft]. Alignment Alignment // Cell returns the rendered cell text for each row. Cell CellFunc[T] }
Column defines one rendered table column.
Click to show internal directories.
Click to hide internal directories.