Optional compile-time conversion from homogeneous object collections.
This module is deliberately not exported by the terminal_table faรงade. Import it when object reflection is useful:
import terminal_table/typed_data let table = tableFromObjects(records, tableColumn(name, "Name"), tableColumn(score, "Score", formatScore))
Column specifications select and order fields. An omitted field is hidden. A formatter must have the signature proc(value: FieldType): string.
Macros
macro tableFromObjects(records: typed; columns: varargs[untyped]): untyped
-
Converts a sequence or array of objects into a table.
With no tableColumn specifications, every field is included in declaration order and its field name becomes the header. Otherwise the specifications are the exact selected order. Omit a field to hide it. The source expression is evaluated exactly once.
Exports
-
initTableMargin, draw, rotateCounterClockwise, CellAddress, initTable, build, removeRows, row, setSpan, isActive, psqlTheme, TableTheme, headerCell, replaceRow, or, Panel, footerSelector, setHeader, clearSpan, extractRows, percentageWidth, initColumn, setMaxRows, initCell, initShadow, setVerticalAlignment, footerCell, setAlignment, setPadding, headerSelector, BorderSet, addRow, addRow, OverflowMode, CellModifier, WidthConstraint, roundedTheme, predicateSelector, duplicateColumn, setTitle, contentWidth, setVerticalAlignment, initTableBuilder, addRow, fromRows, Column, Table, clearShadow, updateCell, allCellsSelector, setAlignment, initLiveTableOptions, TableBuilder, maxRows, replaceRow, splitColumns, startLive, LiveTableOptions, setAlignment, asciiTheme, colorBorders, setFooter, cell, duplicateRow, splitRows, print, transpose, cell, merge, highlight, LiveTableMode, addRow, clearFooter, finishRow, CellPadding, row, maximumWidth, addPanel, PanelPosition, verticalConcat, panel, cellSelector, setVerticalAlignment, fixedWidth, horizontalConcat, borderlessTheme, setPadding, VerticalAlignment, renderFrame, column, clearTitle, rotate180, addCell, apply, addRow, Row, minimumWidth, Selector, Shadow, column, clearHeader, rotateClockwise, CellPredicate, matchingCells, initCellPadding, TableSection, LiveTable, columnSelector, initTable, rowSelector, pad, markdownTheme, columnCount, alignVertical, stopLive, align, Cell, removeColumns, extractColumns, WidthKind, renderToTerminalWidth, CellContext, customTheme, render, initRow, segmentSelector, setWidthPriority, setPadding, modernTheme, TableMargin, initLiveTable, setShadow