Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( AppStyle = lipgloss.NewStyle().Margin(1, 2) TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("205")) StatusBarStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("241")) ErrorStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("196")). Bold(true) // FocusedPaneStyle has a bright border — applied to the active panel. // Width/Height are set dynamically at render time via .Width()/.Height(). FocusedPaneStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("62")) // UnfocusedPaneStyle has a dim border — applied to the inactive panel. UnfocusedPaneStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("240")) // PopupStyle wraps the row detail modal. Bright border + background // so it visually "floats" above the split pane behind it. PopupStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("205")). Padding(1, 2) // PopupLabelStyle is for the column names in the key-value list. PopupLabelStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("63")) Logo = TitleStyle.Render( " ▄▄▄▄ ▄▄▄ ▄▄ ▄▄ ▄▄▄▄▄▄ ▄▄ ▄▄ ▄▄ \n" + "███▄▄ ██▀██ ██ ██ ██ ██ ██ ██ \n" + "▄▄██▀ ▀███▀ ██▄▄▄ ██ ██ ▀███▀ ██ \n" + " ▀▀ ") )
var Keys = KeyMap{ Quit: key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit"), ), SwitchTab: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "switch pane"), ), FocusRight: key.NewBinding( key.WithKeys("right"), key.WithHelp("→", "open & focus"), ), FocusLeft: key.NewBinding( key.WithKeys("left"), key.WithHelp("←", "back"), ), Select: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "select"), ), OpenQuery: key.NewBinding( key.WithKeys("ctrl+e"), key.WithHelp("ctrl+e", "SQL query"), ), }
Functions ¶
This section is empty.
Types ¶
type CloseDetailMsg ¶
type CloseDetailMsg struct{}
CloseDetailMsg is sent when the user dismisses the row detail popup.
type FilePickerModel ¶
type FilePickerModel struct {
// contains filtered or unexported fields
}
FilePickerModel shows a text input for typing a path and a list of SQLite files found in the current directory.
func NewFilePickerModel ¶
func NewFilePickerModel() FilePickerModel
func (FilePickerModel) Init ¶
func (m FilePickerModel) Init() tea.Cmd
func (FilePickerModel) Update ¶
func (m FilePickerModel) Update(msg tea.Msg) (FilePickerModel, tea.Cmd)
func (FilePickerModel) View ¶
func (m FilePickerModel) View() string
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
SwitchTab key.Binding
FocusRight key.Binding
FocusLeft key.Binding
Select key.Binding
OpenQuery key.Binding
}
KeyMap defines shared key bindings used across all views. Centralizing them here (DRY) means one place to change shortcuts.
type QueryInputModel ¶
type QueryInputModel struct {
// contains filtered or unexported fields
}
QueryInputModel is the SQL query popup component. It presents a textarea for writing SQL and executes it on ctrl+r.
func NewQueryInputModel ¶
NewQueryInputModel creates the popup, sized ~70% wide x ~50% tall. Returns a tea.Cmd for the textarea cursor blink.
func (QueryInputModel) Update ¶
func (m QueryInputModel) Update(msg tea.Msg) (QueryInputModel, tea.Cmd)
func (QueryInputModel) View ¶
func (m QueryInputModel) View() string
type QueryResultMsg ¶
QueryResultMsg is sent when the user successfully executes a query. The parent model handles this to populate the right pane.
type RowDetailModel ¶
type RowDetailModel struct {
// contains filtered or unexported fields
}
RowDetailModel displays a single row's data as a vertical key-value list inside a scrollable viewport. This is the "popup" component.
func NewRowDetailModel ¶
func NewRowDetailModel(columns, values []string, termWidth, termHeight int) RowDetailModel
NewRowDetailModel creates the popup. It renders column:value pairs with aligned colons so the values line up neatly.
func (RowDetailModel) Update ¶
func (m RowDetailModel) Update(msg tea.Msg) (RowDetailModel, tea.Cmd)
func (RowDetailModel) View ¶
func (m RowDetailModel) View() string
View renders the viewport content inside the popup border.
type RowSelectedMsg ¶
RowSelectedMsg is sent when the user presses enter on a row. Carries column names + that row's values so the popup can display them.
type TableDataModel ¶
type TableDataModel struct {
// contains filtered or unexported fields
}
TableDataModel wraps bubbles/table.Model to display rows from a DB table. It also stores the raw data so we can pass it to the popup on selection.
func NewTableDataModel ¶
func (*TableDataModel) SetSize ¶
func (m *TableDataModel) SetSize(width, height int)
func (TableDataModel) StatusText ¶
func (m TableDataModel) StatusText() string
StatusText returns info about the table for the parent's status bar.
func (TableDataModel) Update ¶
func (m TableDataModel) Update(msg tea.Msg) (TableDataModel, tea.Cmd)
func (TableDataModel) View ¶
func (m TableDataModel) View() string
type TableItem ¶
type TableItem struct {
Name string
}
TableItem implements the list.Item interface from bubbles. The list component needs items that can provide a title, description, and a filter value (used for the built-in fuzzy search).
func (TableItem) Description ¶
func (TableItem) FilterValue ¶
type TableListModel ¶
type TableListModel struct {
// contains filtered or unexported fields
}
TableListModel wraps bubbles/list.Model. This is the component composition pattern: our model contains a child model and delegates messages to it.
func NewTableListModel ¶
func NewTableListModel(tables []string, width, height int) TableListModel
NewTableListModel creates the table list from a slice of table names.
func (*TableListModel) SetSize ¶
func (m *TableListModel) SetSize(width, height int)
SetSize updates the list dimensions. Called when the terminal resizes.
func (TableListModel) Update ¶
func (m TableListModel) Update(msg tea.Msg) (TableListModel, tea.Cmd)
Update delegates messages to the inner list and checks for selection. Notice the return type is (TableListModel, tea.Cmd) — not (tea.Model, tea.Cmd). Sub-models don't need to satisfy the tea.Model interface; only the root does.
func (TableListModel) View ¶
func (m TableListModel) View() string
View returns the raw list output — no border wrapping. The parent model handles borders/layout so this component can be placed in any layout without double-bordering.
type TableSelectedMsg ¶
type TableSelectedMsg struct {
Name string
}
TableSelectedMsg is sent when the user presses enter on a table. This is how the table list communicates upward to the parent model — through messages, not direct function calls.