Documentation
¶
Index ¶
- func CheckLessAvailable() bool
- func GenerateDefaultCSVFilename() string
- func GenerateFullTableContent(columnNames []string, allRows [][]interface{}, title string) string
- func GetTerminalSize() (width, height int)
- func GetTerminalWidth() int
- func PageQueryResult(data *QueryResultData, queryInfo string) error
- func PageResult(title string, content string) error
- func PageWithContext(ctx context.Context, title string, content string) error
- func SaveCSV(columnNames []string, allRows [][]interface{}, filename string) error
- func SaveQueryResultToCSV(columnNames []string, allRows [][]interface{}, filename string) (string, error)
- type ColumnInfo
- type QueryResultData
- type TableFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLessAvailable ¶
func CheckLessAvailable() bool
CheckLessAvailable returns true if the less command is available
func GenerateDefaultCSVFilename ¶
func GenerateDefaultCSVFilename() string
GenerateDefaultCSVFilename creates a default filename with timestamp
func GenerateFullTableContent ¶
GenerateFullTableContent creates complete formatted table content for paging
func GetTerminalSize ¶
func GetTerminalSize() (width, height int)
GetTerminalSize returns both width and height of the terminal Returns (80, 24) as fallback if detection fails
func GetTerminalWidth ¶
func GetTerminalWidth() int
GetTerminalWidth returns the current terminal width in characters Returns 80 as fallback if detection fails
func PageQueryResult ¶
func PageQueryResult(data *QueryResultData, queryInfo string) error
PageQueryResult is a convenience function for paging query results
func PageResult ¶
PageResult sends formatted table data to less for interactive viewing
func PageWithContext ¶
PageWithContext is a context-aware version of PageResult
Types ¶
type ColumnInfo ¶
ColumnInfo represents information about a table column for formatting
type QueryResultData ¶
type QueryResultData struct {
ColumnNames []string
Rows [][]interface{}
TotalRows int
Truncated bool
}
QueryResultData represents the structure for query results (re-defined here to avoid import cycles)
type TableFormatter ¶
type TableFormatter struct {
// contains filtered or unexported fields
}
TableFormatter handles intelligent table formatting with dynamic column widths
func NewTableFormatter ¶
func NewTableFormatter(columnNames []string) *TableFormatter
NewTableFormatter creates a new table formatter
func (*TableFormatter) AnalyzeData ¶
func (tf *TableFormatter) AnalyzeData(sampleRows [][]interface{})
AnalyzeData analyzes sample data to determine optimal column characteristics
func (*TableFormatter) CalculateColumnWidths ¶
func (tf *TableFormatter) CalculateColumnWidths() []int
CalculateColumnWidths determines optimal column widths based on terminal size
func (*TableFormatter) FormatHeader ¶
func (tf *TableFormatter) FormatHeader(widths []int) string
FormatHeader creates the table header
func (*TableFormatter) FormatRow ¶
func (tf *TableFormatter) FormatRow(row []interface{}, widths []int) string
FormatRow formats a single data row