mirror of
https://github.com/taigrr/teaqlite.git
synced 2026-04-02 04:59:03 -07:00
c32d200c151a4475e12cfbcfb9b35f90008a1fef
SQLite TUI
A fully-featured terminal user interface for browsing SQLite databases built with Bubble Tea v2.
Features
- Table Browser: Browse all tables in your SQLite database with pagination
- Search Functionality: Search tables by name using
/key - Data Viewer: View table data with pagination and row highlighting
- Row-Level Navigation: Navigate through data rows with cursor highlighting
- Data Search: Search within table data using
/key - Row Detail Modal: View individual rows in a 2-column format (Column | Value)
- Cell Editing: Edit individual cell values with live database updates
- SQL Query Interface: Execute custom SQL queries with parameter support
- Responsive Design: Adapts to terminal size and fits content to screen
- Navigation: Intuitive keyboard navigation throughout all modes
Usage
go run main.go <database.db>
Example with the included sample database:
go run main.go sample.db
Keyboard Controls
Table List Mode
↑/↓ork/j: Navigate between tables←/→orh/l: Navigate between table list pages/: Start searching tablesEnter: View selected table datas: Switch to SQL query moder: Refresh table listqorCtrl+C: Quit
Search Mode (when searching tables)
- Type to search table names
EnterorEsc: Finish searchBackspace: Delete characters
Table Data Mode
↑/↓ork/j: Navigate between data rows (with highlighting)←/→orh/l: Navigate between data pages/: Start searching within table dataEnter: View selected row in detail modalEsc: Return to table listr: Refresh current table dataqorCtrl+C: Quit
Data Search Mode (when searching within table data)
- Type to search within all columns of the table
EnterorEsc: Finish searchBackspace: Delete characters
Row Detail Modal
↑/↓ork/j: Navigate between fields (Column | Value format)Enter: Edit selected field valueEsc: Return to table data viewqorCtrl+C: Quit
Cell Edit Mode
- Readline-style Editing: Full cursor control and advanced editing
- Cursor Movement:
←/→arrows,Ctrl+←/→for word navigation - Line Navigation:
Home/Ctrl+A(start),End/Ctrl+E(end) - Deletion:
Backspace,Delete/Ctrl+D,Ctrl+W(word),Ctrl+K(to end),Ctrl+U(to start) - Text Wrapping: Long values are automatically wrapped for better visibility
Enter: Save changes to databaseEsc: Cancel editing and return to row detail
SQL Query Mode
- Advanced Text Editing: Full readline-style editing controls
- Dual Focus Mode: Switch between query input and results with
Tab - Query Input Focus:
- Cursor Movement:
←/→arrows,Ctrl+←/→for word navigation - Line Navigation:
Home/Ctrl+A(start),End/Ctrl+E(end) - Deletion:
Backspace,Delete/Ctrl+D,Ctrl+W(word),Ctrl+K(to end),Ctrl+U(to start) Enter: Execute queryTab: Switch focus to results (when available)
- Cursor Movement:
- Results Focus:
↑/↓ork/j: Navigate between result rowsEnter: View selected row in detail modalTab: Switch focus back to query input
- Type your SQL query (all keys work as input, no conflicts with navigation)
Esc: Return to table listqorCtrl+C: Quit
Features Implemented
- Table Browsing: Lists all tables in the database with pagination
- Table Search: Filter tables by name using
/to search - Paginated Data View: Shows table data with pagination (20 rows per page)
- Row Highlighting: Cursor-based row selection with visual highlighting
- Data Search: Search within table data across all columns
- Row Detail Modal: 2-column view showing Column | Value for selected row
- Cell Editing: Live editing of individual cell values with database updates
- Readline-style Editing: Full cursor control with word navigation, line navigation, and advanced deletion
- Text Wrapping: Long values are automatically wrapped in edit and detail views
- Primary Key Detection: Uses primary keys for reliable row updates
- Screen-Aware Display: Content automatically fits terminal size
- SQL Query Execution: Execute custom SQL queries with advanced text editing and dual-focus mode
- Query Results Navigation: Navigate and interact with query results just like table data
- Error Handling: Displays database errors gracefully
- Responsive UI: Clean, styled interface that adapts to terminal size
- Column Information: Shows column names and handles NULL values
- Navigation: Intuitive keyboard shortcuts for all operations
- Dynamic Column Width: Columns adjust to terminal width
Navigation Flow
Table List → Table Data → Row Detail → Cell Edit
↓ ↓ ↓ ↓
Search Data Search Field Nav Value Edit
↓ ↓ ↓ ↓
SQL Query Row Select Cell Select Save/Cancel
Sample Database
The included sample.db contains:
userstable with id, name, email, age columnsproductstable with id, name, price, category columns
Dependencies
- Bubble Tea - TUI framework
- Lip Gloss - Styling
- go-sqlite3 - SQLite driver
Database Updates
The application supports live editing of database records:
- Uses primary keys when available for reliable row identification
- Falls back to full-row matching when no primary key exists
- Updates are immediately reflected in the interface
- All changes are committed to the database in real-time
Languages
Go
100%