Documentation
¶
Index ¶
- func CalculateColumnWidths(data [][]string) []int
- func FormatASCIITable(data [][]string) string
- func FormatASCIITableBottom(data [][]string) string
- func FormatASCIITableBottomWithWidths(data [][]string, columnWidths []int) string
- func FormatASCIITableHeader(headers [][]string) string
- func FormatASCIITableRowsOnly(data [][]string) string
- func FormatASCIITableRowsOnlyWithWidths(data [][]string, columnWidths []int) string
- func FormatExpandTable(data [][]string, styles *Styles) string
- func NewTable() table.Model
- func OverlayModalOnView(background string, modal ModalOverlay) string
- type AICQLModal
- type AICQLResultMsg
- type AIInfoResponseMsg
- type AIMessage
- type AIModal
- func (m *AIModal) NextChoice()
- func (m *AIModal) PrevChoice()
- func (m *AIModal) Render(screenWidth, screenHeight int, styles *Styles) string
- func (m *AIModal) SetError(err error)
- func (m *AIModal) SetResult(plan *ai.AIResult, cql string)
- func (m *AIModal) ToggleView()
- func (m *AIModal) Update(msg tea.Msg) tea.Cmd
- type AIModalState
- type AIRequestMoreInfoMsg
- type AIRequestUserSelectionMsg
- type AISelectionModal
- type AISelectionResultMsg
- type CompletionModal
- type ConnectionOptions
- type HistoryManager
- type HistoryModal
- type HistorySearchModal
- type Layer
- type LayerManager
- type MainModel
- type Modal
- type ModalOverlay
- type ModalType
- type SlidingWindowTable
- func (swt *SlidingWindowTable) AddRow(row []string)
- func (swt *SlidingWindowTable) CanScrollDown() bool
- func (swt *SlidingWindowTable) CanScrollUp() bool
- func (swt *SlidingWindowTable) GetStatusInfo() string
- func (swt *SlidingWindowTable) GetUncapturedRows() [][]string
- func (swt *SlidingWindowTable) GetVisibleRows(startIdx, endIdx int) [][]string
- func (swt *SlidingWindowTable) LoadMoreRows(maxRows int) int
- func (swt *SlidingWindowTable) MarkRowsAsCaptured(count int)
- func (swt *SlidingWindowTable) Reset()
- type StatusBarModel
- type Styles
- type TopBarModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateColumnWidths ¶ added in v0.0.12
CalculateColumnWidths calculates the maximum width for each column in the data
func FormatASCIITable ¶
FormatASCIITable formats query results as an ASCII table for display in the terminal
func FormatASCIITableBottom ¶ added in v0.0.12
FormatASCIITableBottom draws just the bottom border based on data
func FormatASCIITableBottomWithWidths ¶ added in v0.0.12
FormatASCIITableBottomWithWidths draws just the bottom border with specified column widths
func FormatASCIITableHeader ¶
FormatASCIITableHeader formats just the header part of an ASCII table
func FormatASCIITableRowsOnly ¶ added in v0.0.12
FormatASCIITableRowsOnly formats only the data rows (no headers, no borders) Used for streaming subsequent batches
func FormatASCIITableRowsOnlyWithWidths ¶ added in v0.0.12
FormatASCIITableRowsOnlyWithWidths formats only the data rows with specified column widths
func FormatExpandTable ¶
FormatExpandTable formats query results in expanded vertical format
func OverlayModalOnView ¶
func OverlayModalOnView(background string, modal ModalOverlay) string
OverlayOnView overlays modal content onto a view, preserving background where modal doesn't cover
Types ¶
type AICQLModal ¶ added in v0.0.2
type AICQLModal struct {
Active bool
CQL string // The generated CQL query
Selected int // 0: Execute, 1: Edit, 2: Cancel
}
AICQLModal represents a modal for displaying AI-generated CQL with execution options
func NewAICQLModal ¶ added in v0.0.2
func NewAICQLModal(cql string) *AICQLModal
NewAICQLModal creates a new CQL execution modal
func (*AICQLModal) NextChoice ¶ added in v0.0.2
func (m *AICQLModal) NextChoice()
NextChoice moves to the next button
func (*AICQLModal) PrevChoice ¶ added in v0.0.2
func (m *AICQLModal) PrevChoice()
PrevChoice moves to the previous button
type AICQLResultMsg ¶
type AICQLResultMsg struct {
Plan *ai.AIResult
CQL string
Error error
ConversationID string // Track which conversation this result is for
}
AICQLResultMsg is sent when AI CQL generation completes
type AIInfoResponseMsg ¶
AIInfoResponseMsg is sent when user provides additional information
type AIMessage ¶ added in v0.0.2
type AIMessage struct {
Role string // "user", "assistant", or "system"
Content string // The raw message content (unwrapped)
Type string // Optional type like "cancelled", "selection", etc.
SystemGenerated bool // true if this message was generated by the system, not typed by user
}
AIMessage represents a single message in the AI conversation
type AIModal ¶
type AIModal struct {
State AIModalState
UserRequest string // The natural language request
Plan *ai.AIResult // The generated plan
CQL string // The rendered CQL
Error string // Error message if any
Selected int // 0: Cancel, 1: Execute, 2: Edit
Width int
Height int
ScreenHeight int // Current screen height for dynamic sizing
ShowPlan bool // Toggle between showing plan JSON and CQL
FollowUpInput string // Input for follow-up questions
CursorPosition int // Cursor position in follow-up input
// contains filtered or unexported fields
}
AIModal represents the AI-powered CQL generation modal
func NewAIModal ¶
NewAIModal creates a new AI modal for generating CQL
func (*AIModal) ToggleView ¶
func (m *AIModal) ToggleView()
ToggleView toggles between showing plan JSON and CQL
type AIModalState ¶
type AIModalState int
AIModalState represents the state of the AI modal
const ( AIModalStateGenerating AIModalState = iota AIModalStatePreview AIModalStateError AIModalStateFollowUp // New state for entering follow-up questions AIModalStateInfoFollowUp // New state for the info follow-up input )
type AIRequestMoreInfoMsg ¶
type AIRequestMoreInfoMsg struct {
Message string
}
AIRequestMoreInfoMsg is sent when AI needs more information from user
type AIRequestUserSelectionMsg ¶
AIRequestUserSelectionMsg is sent when AI needs user to select from options
type AISelectionModal ¶
type AISelectionModal struct {
Active bool
Title string // e.g., "Select a keyspace"
Message string // e.g., "Multiple keyspaces found. Please select one:"
SelectionType string // The type being selected (e.g., "keyspace", "table")
Options []string // The list of options to choose from
Selected int // Currently selected option index
ScrollOffset int // Scroll offset for long lists
Width int
Height int
AllowCancel bool // Show cancel button
AllowCustom bool // Allow user to enter custom text
CustomInput string // Custom input text
InputMode bool // Whether we're in custom input mode
MaxVisibleOpts int // Maximum visible options (set during render based on screen height)
}
AISelectionModal represents a modal for user to select from AI-provided options
func NewAISelectionModal ¶
func NewAISelectionModal(selectionType string, options []string) *AISelectionModal
NewAISelectionModal creates a new selection modal
func (*AISelectionModal) GetSelection ¶
func (m *AISelectionModal) GetSelection() string
GetSelection returns the selected value or custom input
func (*AISelectionModal) NextOption ¶
func (m *AISelectionModal) NextOption()
NextOption moves to the next option
func (*AISelectionModal) PrevOption ¶
func (m *AISelectionModal) PrevOption()
PrevOption moves to the previous option
func (*AISelectionModal) Render ¶
func (m *AISelectionModal) Render(screenWidth, screenHeight int, styles *Styles) string
Render renders the selection modal
func (*AISelectionModal) ToggleInputMode ¶
func (m *AISelectionModal) ToggleInputMode()
ToggleInputMode toggles between selection and custom input mode
type AISelectionResultMsg ¶
type AISelectionResultMsg struct {
Selection string
SelectionType string // The type of selection (e.g., "keyspace", "table")
Cancelled bool
}
AISelectionResultMsg is sent when user completes a selection
type CompletionModal ¶
type CompletionModal struct {
// contains filtered or unexported fields
}
CompletionModal represents a modal for showing completions
func NewCompletionModal ¶
func NewCompletionModal(completions []string, currentIndex int) CompletionModal
NewCompletionModal creates a new completion modal
func (CompletionModal) GetOverlay ¶
func (cm CompletionModal) GetOverlay(screenWidth, screenHeight int, styles *Styles) ModalOverlay
GetOverlay returns the modal content and positioning information
func (CompletionModal) RenderContent ¶
func (cm CompletionModal) RenderContent(styles *Styles) string
RenderContent renders just the modal content without positioning
type ConnectionOptions ¶
type ConnectionOptions struct {
Host string
Port int
Keyspace string
Username string
Password string
RequireConfirmation bool
ConnectTimeout int // Connection timeout in seconds
RequestTimeout int // Request timeout in seconds
Debug bool // Enable debug logging
ConfigFile string // Path to custom config file
SSL bool // Enable SSL/TLS connection
Consistency string // Default consistency level (e.g., "QUORUM")
PageSize int // Page size for results
}
ConnectionOptions holds command-line connection options
type HistoryManager ¶
type HistoryManager struct {
// contains filtered or unexported fields
}
HistoryManager manages command history persistence
func NewAIHistoryManager ¶ added in v0.0.2
func NewAIHistoryManager() (*HistoryManager, error)
NewAIHistoryManager creates a new history manager specifically for AI conversations
func NewAIHistoryManagerWithPath ¶ added in v0.0.23
func NewAIHistoryManagerWithPath(customPath string) (*HistoryManager, error)
NewAIHistoryManagerWithPath creates a new AI history manager with a custom path
func NewHistoryManager ¶
func NewHistoryManager() (*HistoryManager, error)
NewHistoryManager creates a new history manager
func NewHistoryManagerWithPath ¶ added in v0.0.23
func NewHistoryManagerWithPath(customPath string) (*HistoryManager, error)
NewHistoryManagerWithPath creates a new history manager with a custom path
func (*HistoryManager) GetHistory ¶
func (hm *HistoryManager) GetHistory() []string
GetHistory returns the command history
func (*HistoryManager) SaveCommand ¶
func (hm *HistoryManager) SaveCommand(command string) error
SaveCommand adds a command to history and saves to file
func (*HistoryManager) SearchHistory ¶
func (hm *HistoryManager) SearchHistory(query string) []string
SearchHistory searches for commands containing the given string
type HistoryModal ¶
type HistoryModal struct {
// contains filtered or unexported fields
}
HistoryModal represents a modal for showing command history
func NewHistoryModal ¶
func NewHistoryModal(history []string, currentIndex int, screenWidth int) HistoryModal
NewHistoryModal creates a new history modal
func (HistoryModal) GetOverlay ¶
func (hm HistoryModal) GetOverlay(screenWidth, screenHeight int, styles *Styles) ModalOverlay
GetOverlay returns the modal content and positioning information
func (HistoryModal) RenderContent ¶
func (hm HistoryModal) RenderContent(styles *Styles) string
RenderContent renders just the modal content without positioning
type HistorySearchModal ¶
type HistorySearchModal struct {
// contains filtered or unexported fields
}
HistorySearchModal represents a modal for searching command history
func NewHistorySearchModal ¶
func NewHistorySearchModal(query string, results []string, selectedIndex int, screenWidth int) HistorySearchModal
NewHistorySearchModal creates a new history search modal
func (HistorySearchModal) GetOverlay ¶
func (hsm HistorySearchModal) GetOverlay(screenWidth, screenHeight int, styles *Styles) ModalOverlay
GetOverlay returns the modal content and positioning information
func (HistorySearchModal) RenderContent ¶
func (hsm HistorySearchModal) RenderContent(styles *Styles) string
RenderContent renders just the modal content without positioning
type Layer ¶
Layer represents a renderable layer with position and size
func RenderModal ¶
RenderModal renders a modal as a centered overlay
type LayerManager ¶
type LayerManager struct {
// contains filtered or unexported fields
}
LayerManager manages multiple layers for rendering
func NewLayerManager ¶
func NewLayerManager(width, height int) *LayerManager
NewLayerManager creates a new layer manager
func (*LayerManager) AddLayer ¶
func (lm *LayerManager) AddLayer(layer Layer)
AddLayer adds a new layer to the manager
func (*LayerManager) Render ¶
func (lm *LayerManager) Render(base string) string
Render composites all layers into a single view
type MainModel ¶
type MainModel struct {
// contains filtered or unexported fields
}
MainModel is the main Bubble Tea model for the application.
func NewMainModelWithConnectionOptions ¶
func NewMainModelWithConnectionOptions(options ConnectionOptions) (*MainModel, error)
NewMainModelWithConnectionOptions creates a new MainModel with connection options.
func NewMainModelWithOptions ¶
NewMainModelWithOptions creates a new MainModel with options.
type Modal ¶
type Modal struct {
Type ModalType
Title string
Message string
Command string
Choices []string
Selected int
Width int
Height int
}
Modal represents a modal dialog
func NewConfirmationModal ¶
NewConfirmationModal creates a new confirmation modal for dangerous commands
type ModalOverlay ¶
type ModalOverlay struct {
Content string
X int // Horizontal position
Y int // Vertical position
Width int // Width of the modal
Height int // Height of the modal
}
ModalOverlay represents positioning information for a modal
type SlidingWindowTable ¶
type SlidingWindowTable struct {
// Configuration
MaxRows int // Maximum rows to keep in memory (e.g., 10000)
MaxMemoryBytes int64 // Maximum memory usage in bytes (e.g., 10MB)
// Data storage
Headers []string // Column headers with (PK)/(C) indicators (always kept)
ColumnNames []string // Original column names without indicators (for data lookup)
Rows [][]string // Current window of rows
ColumnTypes []string // Column types (always kept)
// Window tracking
FirstRowIndex int64 // Global index of first row in window
TotalRowsSeen int64 // Total rows processed (may be more than in memory)
CurrentMemory int64 // Approximate current memory usage
// Indicators for UI
DataDroppedAtStart bool // True if we've dropped rows from the beginning
DataAvailableAtEnd bool // True if more data can be loaded
// Capture tracking
LastCapturedRow int64 // Index of the last row written to capture file
// contains filtered or unexported fields
}
SlidingWindowTable manages a sliding window of table data with memory limits
func NewSlidingWindowTable ¶
func NewSlidingWindowTable(maxRows int, maxMemoryMB int) *SlidingWindowTable
NewSlidingWindowTable creates a new sliding window table
func (*SlidingWindowTable) AddRow ¶
func (swt *SlidingWindowTable) AddRow(row []string)
AddRow adds a row to the sliding window, potentially evicting old rows
func (*SlidingWindowTable) CanScrollDown ¶
func (swt *SlidingWindowTable) CanScrollDown() bool
CanScrollDown returns true if there's data after the current window
func (*SlidingWindowTable) CanScrollUp ¶
func (swt *SlidingWindowTable) CanScrollUp() bool
CanScrollUp returns true if there's data before the current window
func (*SlidingWindowTable) GetStatusInfo ¶
func (swt *SlidingWindowTable) GetStatusInfo() string
GetStatusInfo returns information about the sliding window state
func (*SlidingWindowTable) GetUncapturedRows ¶
func (swt *SlidingWindowTable) GetUncapturedRows() [][]string
GetUncapturedRows returns rows that haven't been written to capture file yet
func (*SlidingWindowTable) GetVisibleRows ¶
func (swt *SlidingWindowTable) GetVisibleRows(startIdx, endIdx int) [][]string
GetVisibleRows returns rows for display within the specified range
func (*SlidingWindowTable) LoadMoreRows ¶
func (swt *SlidingWindowTable) LoadMoreRows(maxRows int) int
LoadMoreRows loads more rows from the streaming result if available
func (*SlidingWindowTable) MarkRowsAsCaptured ¶
func (swt *SlidingWindowTable) MarkRowsAsCaptured(count int)
MarkRowsAsCaptured updates the last captured row index
func (*SlidingWindowTable) Reset ¶
func (swt *SlidingWindowTable) Reset()
Reset clears the sliding window
type StatusBarModel ¶
type StatusBarModel struct {
Username string
Host string
Latency string
Consistency string
PagingSize int
Tracing bool
HasTraceData bool // Whether trace data is available to view
Keyspace string
Version string
OutputFormat string
}
StatusBarModel is the Bubble Tea model for the status bar.
func NewStatusBarModel ¶
func NewStatusBarModel() StatusBarModel
NewStatusBarModel creates a new StatusBarModel.
type Styles ¶
type Styles struct {
Accent lipgloss.Color
Ok lipgloss.Color
Warn lipgloss.Color
Error lipgloss.Color
Muted lipgloss.Color
Border lipgloss.Color
AccentText lipgloss.Style
MutedText lipgloss.Style
ErrorText lipgloss.Style
SuccessText lipgloss.Style
WarnText lipgloss.Style
}
Styles contains the styles for the application.
func DefaultStyles ¶
func DefaultStyles() *Styles
DefaultStyles returns the default styles for the application.
Source Files
¶
- ai_commands.go
- ai_cql_modal.go
- ai_modal.go
- ai_selection_modal.go
- ansi_scroll.go
- ascii_formatter.go
- completion_modal.go
- expand_formatter.go
- helper.go
- history.go
- history_modal.go
- history_search_modal.go
- history_wrapper.go
- keyboard_handler.go
- keyboard_handler_ai_conversation.go
- keyboard_handler_control.go
- keyboard_handler_editing.go
- keyboard_handler_enter.go
- keyboard_handler_enter_ai.go
- keyboard_handler_enter_comments.go
- keyboard_handler_enter_completion.go
- keyboard_handler_enter_modal.go
- keyboard_handler_enter_result.go
- keyboard_handler_enter_special.go
- keyboard_handler_enter_trace.go
- keyboard_handler_escape.go
- keyboard_handler_function_keys.go
- keyboard_handler_history.go
- keyboard_handler_modals.go
- keyboard_handler_space.go
- keyboard_handler_tab.go
- keyboard_navigation_pager.go
- keyboard_navtigation.go
- layers.go
- modal.go
- modal_overlay.go
- model.go
- mouse_handler.go
- save_modal.go
- sliding_window.go
- statusbar.go
- styles.go
- table.go
- table_renderer.go
- table_renderer_multiline.go
- topbar.go
- view_builder.go