Documentation
¶
Index ¶
- func NewAIProvider(provider, apiKey, model string) (ai.Provider, error)
- func SectionConnections() components.SidebarSection
- type App
- type AppState
- type Model
- func (m *Model) Close() error
- func (m *Model) Connect() error
- func (m *Model) Disconnect()
- func (m *Model) ExecuteQuery()
- func (m *Model) FocusEditor()
- func (m *Model) FocusNext()
- func (m *Model) FocusPrev()
- func (m *Model) GenerateSQL(prompt string)
- func (m *Model) GetAIInfo() string
- func (m *Model) GetConnectionInfo() string
- func (m *Model) Init() tea.Cmd
- func (m *Model) LoadDatabases()
- func (m *Model) PreviewTable(tableName string)
- func (m *Model) RefactorSQL(instruction string)
- func (m *Model) RestoreLastState()
- func (m *Model) SwitchDatabase(dbName string) error
- func (m *Model) TestConnection(cfg *config.DatabaseConfig) error
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) UpdateTheme(themeName string)
- func (m *Model) View() string
- type Pane
- type Styles
- type ThemeColors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAIProvider ¶
NewAIProvider is a helper to create AI providers
func SectionConnections ¶
func SectionConnections() components.SidebarSection
Helper to get SectionConnections
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the SQDesk TUI application
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the main application model
func (*Model) Disconnect ¶
func (m *Model) Disconnect()
Disconnect disconnects from the current database
func (*Model) ExecuteQuery ¶
func (m *Model) ExecuteQuery()
ExecuteQuery executes the current SQL query
func (*Model) GenerateSQL ¶
GenerateSQL uses AI to generate SQL from natural language
func (*Model) GetConnectionInfo ¶
GetConnectionInfo returns the current connection info string
func (*Model) LoadDatabases ¶
func (m *Model) LoadDatabases()
LoadDatabases loads the list of available databases
func (*Model) PreviewTable ¶
PreviewTable previews the selected table
func (*Model) RefactorSQL ¶
RefactorSQL uses AI to refactor SQL
func (*Model) RestoreLastState ¶
func (m *Model) RestoreLastState()
RestoreLastState restores the last database and table selection
func (*Model) SwitchDatabase ¶
SwitchDatabase switches to a different database
func (*Model) TestConnection ¶
func (m *Model) TestConnection(cfg *config.DatabaseConfig) error
TestConnection tests a database connection without storing it
func (*Model) UpdateTheme ¶
UpdateTheme updates the theme and regenerates styles
type Styles ¶
type Styles struct {
// App styles
App lipgloss.Style
Header lipgloss.Style
// Panel styles
Panel lipgloss.Style
PanelFocused lipgloss.Style
PanelTitle lipgloss.Style
// Sidebar styles
Sidebar lipgloss.Style
SidebarItem lipgloss.Style
SidebarSelected lipgloss.Style
ActiveConn lipgloss.Style
InactiveConn lipgloss.Style
AddButton lipgloss.Style
// Editor styles
Editor lipgloss.Style
EditorCursor lipgloss.Style
GhostText lipgloss.Style
// Results table styles
ResultsHeader lipgloss.Style
ResultsCell lipgloss.Style
ResultsRow lipgloss.Style
// Status bar styles
StatusBar lipgloss.Style
StatusItem lipgloss.Style
StatusError lipgloss.Style
// Modal styles
Modal lipgloss.Style
ModalTitle lipgloss.Style
ModalContent lipgloss.Style
// Input styles
Input lipgloss.Style
InputFocused lipgloss.Style
InputLabel lipgloss.Style
// Button styles
Button lipgloss.Style
ButtonActive lipgloss.Style
ButtonDisabled lipgloss.Style
// Syntax highlighting
Keyword lipgloss.Style
String lipgloss.Style
Number lipgloss.Style
Comment lipgloss.Style
Function lipgloss.Style
// Messages
ErrorText lipgloss.Style
SuccessText lipgloss.Style
InfoText lipgloss.Style
WarningText lipgloss.Style
// Help
HelpKey lipgloss.Style
HelpDesc lipgloss.Style
}
Styles holds all TUI styles
func NewStyles ¶
func NewStyles(colors ThemeColors) *Styles
NewStyles creates styles based on theme colors
type ThemeColors ¶
type ThemeColors struct {
Primary lipgloss.Color
Secondary lipgloss.Color
Accent lipgloss.Color
Background lipgloss.Color
BackgroundDark lipgloss.Color
BackgroundLight lipgloss.Color
Text lipgloss.Color
TextMuted lipgloss.Color
TextBright lipgloss.Color
Success lipgloss.Color
Warning lipgloss.Color
Error lipgloss.Color
Info lipgloss.Color
Border lipgloss.Color
BorderFocus lipgloss.Color
Selection lipgloss.Color
GhostText lipgloss.Color
}
ThemeColors holds the color palette
func GetDefaultColors ¶
func GetDefaultColors() ThemeColors
GetDefaultColors returns default theme colors
func GetDraculaColors ¶
func GetDraculaColors() ThemeColors
GetDraculaColors returns Dracula theme colors
func GetThemeColors ¶
func GetThemeColors(themeName string) ThemeColors
GetThemeColors returns colors for the specified theme