Skip to content

feat: smart value display formats (UUID, timestamps)#628

Merged
datlechin merged 3 commits intomainfrom
feat/value-display-formats
Apr 7, 2026
Merged

feat: smart value display formats (UUID, timestamps)#628
datlechin merged 3 commits intomainfrom
feat/value-display-formats

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Closes #625.

  • Auto-detect UUIDs in BINARY(16)/VARCHAR(36) columns and Unix timestamps in INT/BIGINT columns
  • Per-column "Display As" override via column header right-click menu (persisted per connection+table)
  • Global "Smart value detection" toggle in Data Grid settings (on by default)
  • Formatted values shown in grid, inspector sidebar, and cell copy; SQL export uses raw values

No competitor does auto-detection — DBeaver, DataGrip, Sequel Ace all require manual per-column configuration.

Detection heuristics (conservative — requires both type + name match):

  • UUID: BINARY(16) columns where name contains "uuid", "guid", or "_id". CHAR/VARCHAR(32/36) where name contains "uuid"/"guid"
  • Unix timestamp: INT/BIGINT columns where name ends with _at, _time, _timestamp, or equals created/updated/modified/timestamp. Sample value validated in 2000-2099 range. Values >10B auto-detected as milliseconds

New files

  • ValueDisplayFormat.swift — enum (raw, uuid, unixTimestamp, unixTimestampMillis)
  • ValueDisplayDetector.swift — heuristic auto-detection engine
  • ValueDisplayFormatService.swift — format application + resolution (override > auto > raw)
  • ValueDisplayFormatStorage.swift — UserDefaults persistence per connection+table

Modified files

  • CellDisplayFormatter.swift — new displayFormat parameter, applied before date/blob formatting
  • RowProvider.swift — stores columnDisplayFormats, passes to formatter
  • AppSettings.swift / DataGridSettingsView.swiftenableSmartValueDetection toggle
  • DataGridView+Sort.swift — "Display As" submenu in column header context menu
  • DataGridCoordinator.swift — settings change observer for smart detection toggle
  • DataGridView+RowActions.swift — copy cell uses formatted value when format active
  • MainContentView+Bindings.swift — sidebar applies display format
  • MainEditorContentView.swift — wires up auto-detection on row provider creation

Test plan

  • Connect to MySQL with BINARY(16) UUID column (name containing "uuid"/"id") → verify auto-renders as UUID
  • Connect to any DB with INT created_at column → verify shows human-readable date
  • Right-click column header → "Display As" → switch between formats, verify checkmark updates
  • Override persists after re-opening the table
  • Toggle "Smart value detection" off in Settings → auto-detection stops, overrides still work
  • Copy cell with UUID format → clipboard has UUID string
  • Copy as INSERT → raw binary value used (not UUID string)
  • Multiple connections open simultaneously → formats don't cross-contaminate
  • Query tab (no table) → auto-detection works, "Display As" menu works (non-persisted)

@datlechin datlechin merged commit 1f18b82 into main Apr 7, 2026
1 check passed
@datlechin datlechin deleted the feat/value-display-formats branch April 7, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UUID readability

1 participant