- Implement functionality to create, update, delete, and view relationships between tables. - Introduce new UI screens for managing relationships, including forms for adding and editing relationships. - Enhance table editor with navigation to relationship management. - Ensure relationships are displayed in a structured table format for better usability.
58 lines
2.0 KiB
Go
58 lines
2.0 KiB
Go
// Package ui provides an interactive terminal user interface (TUI) for editing database schemas.
|
|
//
|
|
// # Overview
|
|
//
|
|
// The ui package implements a full-featured terminal-based schema editor using tview,
|
|
// allowing users to visually create, modify, and manage database schemas without writing
|
|
// code or SQL.
|
|
//
|
|
// # Features
|
|
//
|
|
// The schema editor supports:
|
|
// - Database management: Edit name, description, and properties
|
|
// - Schema management: Create, edit, delete schemas
|
|
// - Table management: Create, edit, delete tables
|
|
// - Column management: Add, modify, delete columns with full property support
|
|
// - Relationship management: Define and edit table relationships
|
|
// - Domain management: Organize tables into logical domains
|
|
// - Import & merge: Combine schemas from multiple sources
|
|
// - Save: Export to any supported format
|
|
//
|
|
// # Architecture
|
|
//
|
|
// The package is organized into several components:
|
|
// - editor.go: Main editor and application lifecycle
|
|
// - *_screens.go: UI screens for each entity type
|
|
// - *_dataops.go: Business logic and data operations
|
|
// - dialogs.go: Reusable dialog components
|
|
// - load_save_screens.go: File I/O and format selection
|
|
// - main_menu.go: Primary navigation menu
|
|
//
|
|
// # Usage
|
|
//
|
|
// editor := ui.NewSchemaEditor(database)
|
|
// if err := editor.Run(); err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// Or with pre-configured load/save options:
|
|
//
|
|
// editor := ui.NewSchemaEditorWithConfigs(database, loadConfig, saveConfig)
|
|
// if err := editor.Run(); err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
//
|
|
// # Navigation
|
|
//
|
|
// - Arrow keys: Navigate between items
|
|
// - Enter: Select/edit item
|
|
// - Tab/Shift+Tab: Navigate between buttons
|
|
// - Escape: Go back/cancel
|
|
// - Letter shortcuts: Quick actions (e.g., 'n' for new, 'e' for edit, 'd' for delete)
|
|
//
|
|
// # Integration
|
|
//
|
|
// The editor integrates with all readers and writers, supporting load/save operations
|
|
// for any format supported by RelSpec (DBML, PostgreSQL, GORM, Prisma, etc.).
|
|
package ui
|