Skip to main content

table_data

Function table_data 

Source
pub fn table_data(columns: &[&str], rows: Vec<Value>) -> Value
Expand description

Build the columnar table block shared by every list-style payload.

Field names are stated once in columns; each item becomes a positional row aligned to that column order, and count is the row total. This keeps --json list output compact and uniform across capabilities (services and packages both project through here). Callers own per-cell typing: a row value may be any Value, so an integer column (e.g. install_size) stays an integer rather than being stringified.

Returns a {"columns": [...], "rows": [[...]], "count": N} object. Extra per-kind context (e.g. scope, pattern) is added by the caller as a sibling key, not folded in here.