MCPcopy Create free account
hub / github.com/douglance/devsql / format_output

Function format_output

crates/vcsql/src/cli/output.rs:8–20  ·  view source on GitHub ↗
(
    result: &QueryResult,
    format: &OutputFormat,
    no_header: bool,
    writer: &mut W,
)

Source from the content-addressed store, hash-verified

6use tabled::settings::{Style, Width};
7
8pub fn format_output<W: Write>(
9 result: &QueryResult,
10 format: &OutputFormat,
11 no_header: bool,
12 writer: &mut W,
13) -> Result<()> {
14 match format {
15 OutputFormat::Table => format_table(result, no_header, writer),
16 OutputFormat::Json => format_json(result, writer),
17 OutputFormat::Jsonl => format_jsonl(result, writer),
18 OutputFormat::Csv => format_csv(result, no_header, writer),
19 }
20}
21
22fn format_table<W: Write>(result: &QueryResult, no_header: bool, writer: &mut W) -> Result<()> {
23 if result.is_empty() {

Callers 1

execute_queryFunction · 0.85

Calls 4

format_tableFunction · 0.85
format_jsonFunction · 0.85
format_jsonlFunction · 0.85
format_csvFunction · 0.85

Tested by

no test coverage detected