ADR-0016 + Iter 5/6 follow-up: pretty table rendering
Replaces the placeholder pipe-and-dash output with Unicode box-drawing tables for both data results and table-structure listings, per ADR-0016. * New `src/output_render.rs` module with `render_data_table` and `render_structure`. Hand-rolled to match the project's existing CSV/YAML pattern; ~300 lines. * Header-only outer-frame border style: outer ┌─┐│└─┘ box + ├─┤ header underline, no per-row separators. NULL renders as `(null)`; cell newlines/tabs/control chars become `↵`/`→`/`·` as display-only substitutions. * Type-aware column alignment: numeric types right-aligned, everything else left. `DataResult` gains a `column_types: Vec<Option<Type>>` field, populated from the existing metadata lookup at the two query sites in db.rs (no new query paths). * Structure view shows Name | Type | Constraints columns; References / Referenced-by sections retain plain-text format, leaving room for the future relationship-rendering ADR. * 18 new unit tests in output_render.rs (plus 4 insta snapshots for the canonical layouts). Existing assertions in app.rs and walking_skeleton.rs updated to match the new format. Total: 426 passing, 0 failing, 0 skipped (up from 408). Clippy clean.
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
---
|
||||
source: src/output_render.rs
|
||||
expression: "render_data_table(&data).join(\"\\n\")"
|
||||
---
|
||||
┌────┬───────┬──────────────┐
|
||||
│ id │ Name │ Email │
|
||||
├────┼───────┼──────────────┤
|
||||
│ 1 │ Alice │ a@example.io │
|
||||
│ 2 │ Bob │ b@example.io │
|
||||
└────┴───────┴──────────────┘
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
---
|
||||
source: src/output_render.rs
|
||||
expression: out
|
||||
---
|
||||
┌───────────┬──────┐
|
||||
│ id │ Name │
|
||||
├───────────┼──────┤
|
||||
│ (no rows) │ │
|
||||
└───────────┴──────┘
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
source: src/output_render.rs
|
||||
expression: "render_structure(&desc).join(\"\\n\")"
|
||||
---
|
||||
Customers
|
||||
┌───────┬────────┬─────────────┐
|
||||
│ Name │ Type │ Constraints │
|
||||
├───────┼────────┼─────────────┤
|
||||
│ id │ serial │ PK │
|
||||
│ Name │ text │ NOT NULL │
|
||||
│ Email │ text │ │
|
||||
└───────┴────────┴─────────────┘
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
---
|
||||
source: src/output_render.rs
|
||||
expression: out
|
||||
---
|
||||
Customers
|
||||
┌──────┬────────┬─────────────┐
|
||||
│ Name │ Type │ Constraints │
|
||||
├──────┼────────┼─────────────┤
|
||||
│ id │ serial │ PK │
|
||||
└──────┴────────┴─────────────┘
|
||||
Referenced by:
|
||||
Orders.cust_id → id (cust_orders, on delete cascade, on update no action)
|
||||
Reference in New Issue
Block a user