Documentation
¶
Index ¶
- type AIPrompt
- func (a *AIPrompt) ClearContext()
- func (a AIPrompt) GetMode() AIPromptMode
- func (a AIPrompt) GetValue() string
- func (a *AIPrompt) Hide()
- func (a AIPrompt) IsVisible() bool
- func (a *AIPrompt) SetContext(text string)
- func (a *AIPrompt) SetSize(width, height int)
- func (a *AIPrompt) Show(mode AIPromptMode)
- func (a AIPrompt) Update(msg tea.Msg) (AIPrompt, tea.Cmd)
- func (a AIPrompt) View() string
- type AIPromptMode
- type AIPromptStyles
- type AddConnectionItem
- type CompletionPopup
- func (c CompletionPopup) GetPosition() (int, int)
- func (c CompletionPopup) GetSelected() *completion.CompletionItem
- func (c *CompletionPopup) Hide()
- func (c CompletionPopup) IsVisible() bool
- func (c *CompletionPopup) MoveDown()
- func (c *CompletionPopup) MoveUp()
- func (c *CompletionPopup) SetPosition(x, y int)
- func (c *CompletionPopup) SetWidth(w int)
- func (c *CompletionPopup) Show(items []completion.CompletionItem, x, y int)
- func (c CompletionPopup) Update(msg tea.Msg) (CompletionPopup, tea.Cmd)
- func (c CompletionPopup) View() string
- type CompletionStyles
- type ConnectionAction
- type ConnectionItem
- type ConnectionModal
- func (m ConnectionModal) GetConnectionIndex() int
- func (m ConnectionModal) GetSelectedAction() ConnectionAction
- func (m *ConnectionModal) Hide()
- func (m ConnectionModal) IsVisible() bool
- func (m *ConnectionModal) MoveDown()
- func (m *ConnectionModal) MoveUp()
- func (m *ConnectionModal) SetSize(width, height int)
- func (m *ConnectionModal) SetStatus(msg string, isError bool)
- func (m *ConnectionModal) Show(connName string, connIndex int)
- func (m ConnectionModal) View() string
- type ConnectionModalStyles
- type DatabaseItem
- type Editor
- func (e Editor) GetCursorPosition() int
- func (e Editor) GetSelectedText() string
- func (e Editor) GetValue() string
- func (e Editor) HighlightSQL(sql string) string
- func (e *Editor) InsertText(text string)
- func (e Editor) IsFocused() bool
- func (e *Editor) ReplaceCurrentWord(text string)
- func (e *Editor) SetFocused(focused bool)
- func (e *Editor) SetKeyMap(km config.KeyMap)
- func (e *Editor) SetPosition(x, y int)
- func (e *Editor) SetSchema(schema map[string][]string)
- func (e *Editor) SetSize(width, height int)
- func (e *Editor) SetValue(value string)
- func (e Editor) Update(msg tea.Msg) (Editor, tea.Cmd)
- func (e Editor) View() string
- type EditorMode
- type EditorState
- type EditorStyles
- type Help
- type HelpStyles
- type Position
- type Results
- func (r *Results) Clear()
- func (r Results) CopyAllData() error
- func (r Results) CopySelectedRow() error
- func (r Results) GetRowCount() int
- func (r Results) GetViewMode() ViewMode
- func (r Results) IsFocused() bool
- func (r *Results) NextPage()
- func (r *Results) PrevPage()
- func (r *Results) SetData(columns []string, rows []map[string]interface{})
- func (r *Results) SetError(err error)
- func (r *Results) SetFocused(focused bool)
- func (r *Results) SetMessage(msg string)
- func (r *Results) SetSize(width, height int)
- func (r *Results) SetViewMode(mode ViewMode)
- func (r Results) Update(msg tea.Msg) (Results, tea.Cmd)
- func (r Results) View() string
- type ResultsStyles
- type Settings
- func (s *Settings) ClearConnection()
- func (s *Settings) ClearStatus()
- func (s Settings) GetAPIKey() string
- func (s Settings) GetConnectionConfig() (name, driver, host, port, user, pass, db string)
- func (s Settings) GetEditingConnIndex() int
- func (s Settings) GetModel() string
- func (s Settings) GetSelectedProvider() string
- func (s Settings) GetSelectedTheme() string
- func (s Settings) GetStatus() (string, bool)
- func (s *Settings) Hide()
- func (s Settings) IsEditingConnection() bool
- func (s Settings) IsVisible() bool
- func (s *Settings) LoadConnection(name, driver, host string, port int, user, pass, database string, ...)
- func (s *Settings) NextTab()
- func (s *Settings) PrevTab()
- func (s *Settings) SetAIProvider(provider string)
- func (s *Settings) SetAPIKey(key string)
- func (s *Settings) SetModel(model string)
- func (s *Settings) SetSize(width, height int)
- func (s *Settings) SetStatus(msg string, isError bool)
- func (s *Settings) SetTheme(theme string)
- func (s *Settings) Show()
- func (s *Settings) ShowForConnection()
- func (s Settings) Update(msg tea.Msg) (Settings, tea.Cmd)
- func (s Settings) View() string
- type SettingsStyles
- type SettingsTab
- type ShortcutCategory
- type ShortcutItem
- type Sidebar
- func (s *Sidebar) AddConnection(conn ConnectionItem)
- func (s Sidebar) GetConnections() []ConnectionItem
- func (s Sidebar) GetCurrentDatabase() string
- func (s Sidebar) GetDatabases() []string
- func (s Sidebar) GetSection() SidebarSection
- func (s Sidebar) GetSelectedConnection() int
- func (s Sidebar) GetSelectedDatabase() string
- func (s Sidebar) GetTables() []string
- func (s Sidebar) IsAddConnectionSelected() bool
- func (s Sidebar) IsFocused() bool
- func (s *Sidebar) SelectTable(tableName string)
- func (s Sidebar) SelectedTable() string
- func (s *Sidebar) SetActiveConnection(index int)
- func (s *Sidebar) SetConnections(connections []ConnectionItem)
- func (s *Sidebar) SetDatabases(databases []string, current string)
- func (s *Sidebar) SetFocused(focused bool)
- func (s *Sidebar) SetSection(section SidebarSection)
- func (s *Sidebar) SetSize(width, height int)
- func (s *Sidebar) SetTables(tables []string)
- func (s *Sidebar) ToggleSection()
- func (s Sidebar) Update(msg tea.Msg) (Sidebar, tea.Cmd)
- func (s Sidebar) View() string
- type SidebarSection
- type SidebarStyles
- type TableItem
- type ViewMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIPrompt ¶
type AIPrompt struct {
// contains filtered or unexported fields
}
AIPrompt component for AI input modal
func NewAIPrompt ¶
func NewAIPrompt(styles AIPromptStyles) AIPrompt
NewAIPrompt creates a new AI prompt component
func (*AIPrompt) SetContext ¶
SetContext sets the selected text context
type AIPromptMode ¶
type AIPromptMode int
AIPromptMode indicates the type of AI operation
const ( AIPromptModeNL2SQL AIPromptMode = iota AIPromptModeRefactor )
type AIPromptStyles ¶
type AIPromptStyles struct {
Modal lipgloss.Style
Title lipgloss.Style
Input lipgloss.Style
Hint lipgloss.Style
ModeNL2SQL lipgloss.Style
ModeRefactor lipgloss.Style
}
AIPromptStyles holds styling for the AI prompt
type AddConnectionItem ¶
type AddConnectionItem struct{}
AddConnectionItem represents the add button
func (AddConnectionItem) Description ¶
func (a AddConnectionItem) Description() string
func (AddConnectionItem) FilterValue ¶
func (a AddConnectionItem) FilterValue() string
func (AddConnectionItem) Title ¶
func (a AddConnectionItem) Title() string
type CompletionPopup ¶
type CompletionPopup struct {
// contains filtered or unexported fields
}
CompletionPopup shows completion suggestions
func NewCompletionPopup ¶
func NewCompletionPopup(styles CompletionStyles) CompletionPopup
NewCompletionPopup creates a new completion popup
func (CompletionPopup) GetPosition ¶
func (c CompletionPopup) GetPosition() (int, int)
GetPosition returns the popup position
func (CompletionPopup) GetSelected ¶
func (c CompletionPopup) GetSelected() *completion.CompletionItem
GetSelected returns the selected item
func (CompletionPopup) IsVisible ¶
func (c CompletionPopup) IsVisible() bool
IsVisible returns if popup is visible
func (*CompletionPopup) MoveDown ¶
func (c *CompletionPopup) MoveDown()
MoveDown moves selection down
func (*CompletionPopup) SetPosition ¶
func (c *CompletionPopup) SetPosition(x, y int)
SetPosition sets the popup position
func (*CompletionPopup) SetWidth ¶
func (c *CompletionPopup) SetWidth(w int)
SetWidth sets the popup width
func (*CompletionPopup) Show ¶
func (c *CompletionPopup) Show(items []completion.CompletionItem, x, y int)
Show displays the popup with items
func (CompletionPopup) Update ¶
func (c CompletionPopup) Update(msg tea.Msg) (CompletionPopup, tea.Cmd)
Update handles input
type CompletionStyles ¶
type CompletionStyles struct {
Border lipgloss.Style
Item lipgloss.Style
Selected lipgloss.Style
Kind lipgloss.Style
Detail lipgloss.Style
}
CompletionStyles holds styling for the popup
type ConnectionAction ¶
type ConnectionAction int
ConnectionAction represents the action selected in the modal
const ( ActionNone ConnectionAction = iota ActionConnect ActionEdit ActionDelete ActionCancel )
type ConnectionItem ¶
ConnectionItem represents a connection in the sidebar
func (ConnectionItem) Description ¶
func (c ConnectionItem) Description() string
func (ConnectionItem) FilterValue ¶
func (c ConnectionItem) FilterValue() string
func (ConnectionItem) Title ¶
func (c ConnectionItem) Title() string
type ConnectionModal ¶
type ConnectionModal struct {
// contains filtered or unexported fields
}
ConnectionModal component for connection actions pop-up
func NewConnectionModal ¶
func NewConnectionModal(styles ConnectionModalStyles) ConnectionModal
NewConnectionModal creates a new connection modal
func (ConnectionModal) GetConnectionIndex ¶
func (m ConnectionModal) GetConnectionIndex() int
GetConnectionIndex returns the connection index
func (ConnectionModal) GetSelectedAction ¶
func (m ConnectionModal) GetSelectedAction() ConnectionAction
GetSelectedAction returns the selected action
func (ConnectionModal) IsVisible ¶
func (m ConnectionModal) IsVisible() bool
IsVisible returns if modal is visible
func (*ConnectionModal) MoveDown ¶
func (m *ConnectionModal) MoveDown()
MoveDown moves selection down
func (*ConnectionModal) SetSize ¶
func (m *ConnectionModal) SetSize(width, height int)
SetSize sets the modal dimensions
func (*ConnectionModal) SetStatus ¶
func (m *ConnectionModal) SetStatus(msg string, isError bool)
SetStatus sets the status message
func (*ConnectionModal) Show ¶
func (m *ConnectionModal) Show(connName string, connIndex int)
Show shows the modal for a connection
type ConnectionModalStyles ¶
type ConnectionModalStyles struct {
Modal lipgloss.Style
Title lipgloss.Style
Item lipgloss.Style
Selected lipgloss.Style
Hint lipgloss.Style
Success lipgloss.Style
Error lipgloss.Style
}
ConnectionModalStyles holds styling for the modal
type DatabaseItem ¶
type DatabaseItem struct {
// contains filtered or unexported fields
}
DatabaseItem represents a database in the sidebar
func (DatabaseItem) Description ¶
func (d DatabaseItem) Description() string
func (DatabaseItem) FilterValue ¶
func (d DatabaseItem) FilterValue() string
func (DatabaseItem) Title ¶
func (d DatabaseItem) Title() string
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor component for SQL editing (Sublime-like)
func NewEditor ¶
func NewEditor(styles EditorStyles) Editor
NewEditor creates a new editor component
func (Editor) GetCursorPosition ¶
GetCursorPosition returns the cursor position as character offset
func (Editor) GetSelectedText ¶
GetSelectedText returns the text to execute
func (Editor) HighlightSQL ¶
HighlightSQL applies basic syntax highlighting to SQL
func (*Editor) InsertText ¶
InsertText inserts text at the current cursor position
func (*Editor) ReplaceCurrentWord ¶
ReplaceCurrentWord replaces the word being typed with the given text
func (*Editor) SetFocused ¶
SetFocused sets the focus state
func (*Editor) SetPosition ¶
SetPosition sets the absolute position of the editor
type EditorMode ¶
type EditorMode int
EditorMode represents the current mode of the editor
const ( ModeNormal EditorMode = iota ModeInsert ModeVisual )
type EditorState ¶
EditorState represents a snapshot of the editor
type EditorStyles ¶
type EditorStyles struct {
Normal lipgloss.Style
Focused lipgloss.Style
Title lipgloss.Style
LineNum lipgloss.Style
Keyword lipgloss.Style
String lipgloss.Style
GhostText lipgloss.Style
Selection lipgloss.Style
Suggestion lipgloss.Style
Type lipgloss.Style
Function lipgloss.Style
Operator lipgloss.Style
Mode lipgloss.Style
}
EditorStyles holds styling for the editor
type Help ¶
type Help struct {
// contains filtered or unexported fields
}
Help component for displaying shortcuts
type HelpStyles ¶
type HelpStyles struct {
Modal lipgloss.Style
Title lipgloss.Style
Category lipgloss.Style
Key lipgloss.Style
Desc lipgloss.Style
}
HelpStyles holds styling for the help modal
type Results ¶
type Results struct {
// contains filtered or unexported fields
}
Results component for displaying query results
func NewResults ¶
func NewResults(styles ResultsStyles) Results
NewResults creates a new results component
func (Results) CopyAllData ¶
CopyAllData copies all data to clipboard as TSV
func (Results) CopySelectedRow ¶
CopySelectedRow copies the selected row data to clipboard
func (Results) GetRowCount ¶
GetRowCount returns the number of rows
func (Results) GetViewMode ¶
GetViewMode returns the current view mode
func (*Results) SetFocused ¶
SetFocused sets the focus state
func (*Results) SetMessage ¶
SetMessage sets an info message
func (*Results) SetViewMode ¶
SetViewMode sets the current view mode
type ResultsStyles ¶
type ResultsStyles struct {
Normal lipgloss.Style
Focused lipgloss.Style
Title lipgloss.Style
Header lipgloss.Style
Cell lipgloss.Style
SelectedRow lipgloss.Style
Error lipgloss.Style
Info lipgloss.Style
}
ResultsStyles holds styling for the results
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings component for settings modal
func NewSettings ¶
func NewSettings(styles SettingsStyles) Settings
NewSettings creates a new settings component
func (*Settings) ClearConnection ¶
func (s *Settings) ClearConnection()
ClearConnection clears all connection form fields (for new connection)
func (*Settings) ClearStatus ¶
func (s *Settings) ClearStatus()
ClearStatus clears the status message
func (Settings) GetConnectionConfig ¶
GetConnectionConfig returns the connection configuration
func (Settings) GetEditingConnIndex ¶
GetEditingConnIndex returns the index of connection being edited (-1 if new)
func (Settings) GetSelectedProvider ¶
GetSelectedProvider returns the selected AI provider
func (Settings) GetSelectedTheme ¶
GetSelectedTheme returns the selected theme name
func (Settings) IsEditingConnection ¶
IsEditingConnection returns true if editing existing connection
func (*Settings) LoadConnection ¶
func (s *Settings) LoadConnection(name, driver, host string, port int, user, pass, database string, editIndex int)
LoadConnection loads connection data into the form for editing
func (*Settings) SetAIProvider ¶
SetAIProvider sets the AI provider
func (*Settings) ShowForConnection ¶
func (s *Settings) ShowForConnection()
ShowForConnection shows settings modal and switches to Connections tab
type SettingsStyles ¶
type SettingsStyles struct {
Modal lipgloss.Style
Title lipgloss.Style
Tab lipgloss.Style
TabActive lipgloss.Style
Label lipgloss.Style
Input lipgloss.Style
InputFocus lipgloss.Style
Button lipgloss.Style
ButtonActive lipgloss.Style
Selected lipgloss.Style
Hint lipgloss.Style
Success lipgloss.Style
Error lipgloss.Style
}
SettingsStyles holds styling for the settings
type SettingsTab ¶
type SettingsTab int
SettingsTab represents a tab in settings
const ( SettingsTabTheme SettingsTab = iota SettingsTabAI SettingsTabConnections )
type ShortcutCategory ¶
type ShortcutCategory struct {
Name string
Items []ShortcutItem
}
ShortcutCategory represents a category of shortcuts
type ShortcutItem ¶
ShortcutItem represents a single shortcut
type Sidebar ¶
type Sidebar struct {
// contains filtered or unexported fields
}
Sidebar component for displaying connections, databases and tables
func NewSidebar ¶
func NewSidebar(styles SidebarStyles) Sidebar
NewSidebar creates a new sidebar component
func (*Sidebar) AddConnection ¶
func (s *Sidebar) AddConnection(conn ConnectionItem)
AddConnection adds a connection to the list
func (Sidebar) GetConnections ¶
func (s Sidebar) GetConnections() []ConnectionItem
GetConnections returns the connections list
func (Sidebar) GetCurrentDatabase ¶
GetCurrentDatabase returns the current active database
func (Sidebar) GetDatabases ¶
GetDatabases returns the databases list
func (Sidebar) GetSection ¶
func (s Sidebar) GetSection() SidebarSection
GetSection returns the current section
func (Sidebar) GetSelectedConnection ¶
GetSelectedConnection returns the selected connection index
func (Sidebar) GetSelectedDatabase ¶
GetSelectedDatabase returns the selected database name
func (Sidebar) IsAddConnectionSelected ¶
IsAddConnectionSelected returns true if "+ Add Connection" is selected
func (*Sidebar) SelectTable ¶
SelectTable sets a table as selected
func (Sidebar) SelectedTable ¶
SelectedTable returns the currently selected table name
func (*Sidebar) SetActiveConnection ¶
SetActiveConnection sets which connection is active
func (*Sidebar) SetConnections ¶
func (s *Sidebar) SetConnections(connections []ConnectionItem)
SetConnections sets the list of connections
func (*Sidebar) SetDatabases ¶
SetDatabases sets the list of databases
func (*Sidebar) SetFocused ¶
SetFocused sets the focus state
func (*Sidebar) SetSection ¶
func (s *Sidebar) SetSection(section SidebarSection)
SetSection sets the current section
func (*Sidebar) ToggleSection ¶
func (s *Sidebar) ToggleSection()
ToggleSection switches between connections and tables
type SidebarSection ¶
type SidebarSection int
SidebarSection represents which section is focused
const ( SectionConnections SidebarSection = iota SectionDatabases SectionTables )
type SidebarStyles ¶
type SidebarStyles struct {
Normal lipgloss.Style
Focused lipgloss.Style
Title lipgloss.Style
Item lipgloss.Style
Selected lipgloss.Style
AddButton lipgloss.Style
ActiveConn lipgloss.Style
InactiveConn lipgloss.Style
}
SidebarStyles holds styling for the sidebar
type TableItem ¶
type TableItem struct {
// contains filtered or unexported fields
}
TableItem represents a table in the sidebar