Documentation
¶
Overview ¶
Completion-schema plumbing for the app: CompletionSchema assembles the query.Schema the SQL completer works from, WarmCompletionSchema fills the live-connection side of it off the update loop.
Package ui celledit holds the commit helpers for single-cell edits and row deletes. In database mode it builds and runs UPDATE/DELETE statements keyed on the table's primary key; in file mode it rewrites the frame in place through WithCell/WithoutRows and pushes the new frame.
Index ¶
- Constants
- Variables
- func Box(title, content string, w int, th *theme.Theme) string
- func CloseOverlay() tea.Msg
- func Composite(base, box string, w, h int) string
- func FillPage(box string, w, h int) string
- func FilterLine(filter string, filtering bool, width int, hint string, th *theme.Theme) string
- func HighlightPad(s, needle string, w int, matchStyle, baseStyle lipgloss.Style) string
- func HighlightRunes(s string, indices []int, matchStyle, baseStyle lipgloss.Style) string
- func HighlightSubstr(s, needle string, matchStyle, baseStyle lipgloss.Style) string
- func Run(app *App) error
- type App
- func (a *App) ActivePaneID() int
- func (a *App) ActiveTab() int
- func (a *App) Backend() db.Backend
- func (a *App) BaseCrumb() string
- func (a *App) ColumnNames() []string
- func (a *App) CompletionSchema() query.Schema
- func (a *App) Crumbs() []string
- func (a *App) CurrentFrame() *data.Frame
- func (a *App) CurrentRow() int
- func (a *App) CurrentTableNamespace() string
- func (a *App) Engine() *query.Engine
- func (a *App) Init() tea.Cmd
- func (a *App) KV() db.KVBackend
- func (a *App) PendingDelete() *PendingDelete
- func (a *App) PendingEdit() *PendingEdit
- func (a *App) PushOverlay(ov Overlay)
- func (a *App) SheetFieldCursor() int
- func (a *App) ShowBorders() bool
- func (a *App) ShowRowNumbers() bool
- func (a *App) TableNames() []string
- func (a *App) Tabs() []TabInfo
- func (a *App) Theme() *theme.Theme
- func (a *App) ThemeName() string
- func (a *App) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (a *App) View() tea.View
- func (a *App) WarmCompletionSchema(tables ...string)
- type AppContext
- type ApplyFrameMsg
- type Binding
- type CloseOverlayMsg
- type CloseTabMsg
- type CopyTextMsg
- type ErrorMsg
- type ExecProcessMsg
- type FullscreenOverlay
- type JumpToRowMsg
- type JumpToTabMsg
- type OobeColsSelectedMsg
- type Options
- type Overlay
- type OverlayIniter
- type Pane
- type PendingDelete
- type PendingEdit
- type PushOverlayMsg
- type RegisterTableMsg
- type RenderOpts
- type ReplaceBaseMsg
- type ResetStackMsg
- type RunCommandMsg
- type SearchBar
- func (s *SearchBar) Active() bool
- func (s *SearchBar) Backspace()
- func (s *SearchBar) Cancel()
- func (s *SearchBar) Commit() (f *data.Frame, crumb string, ok bool)
- func (s *SearchBar) Fuzzy() bool
- func (s *SearchBar) Paste(text string)
- func (s *SearchBar) Preview() *data.Frame
- func (s *SearchBar) Query() string
- func (s *SearchBar) Start(f *data.Frame, fuzzy bool)
- func (s *SearchBar) StartCols(f *data.Frame, fuzzy bool, cols []int)
- func (s *SearchBar) Type(text string)
- func (s *SearchBar) View(width int, th *theme.Theme) string
- type SetBackendMsg
- type SetPageMsg
- type SetQueryParamsMsg
- type SetThemeMsg
- type SetTimeRangeMsg
- type TabInfo
- type TableView
- func (tv *TableView) Bottom(nrows int)
- func (tv *TableView) ClampTo(f *data.Frame)
- func (tv *TableView) ClearSelect()
- func (tv *TableView) ColCursor() int
- func (tv *TableView) ColOff() int
- func (tv *TableView) Expanded() bool
- func (tv *TableView) FirstCol()
- func (tv *TableView) HalfPageDown(nrows int)
- func (tv *TableView) HalfPageUp(nrows int)
- func (tv *TableView) IsSelected(row int) bool
- func (tv *TableView) JumpTo(row, nrows int)
- func (tv *TableView) LastCol(ncols int)
- func (tv *TableView) Move(delta, nrows int)
- func (tv *TableView) NextCol(ncols int)
- func (tv *TableView) PageDown(nrows int)
- func (tv *TableView) PageSize() int
- func (tv *TableView) PageUp(nrows int)
- func (tv *TableView) PrevCol(ncols int)
- func (tv *TableView) Random(nrows int)
- func (tv *TableView) Render(f *data.Frame, o RenderOpts) string
- func (tv *TableView) Reset()
- func (tv *TableView) Sel() int
- func (tv *TableView) SelectedRows() []int
- func (tv *TableView) SetColCursor(i, ncols int)
- func (tv *TableView) ToggleExpanded()
- func (tv *TableView) ToggleSelect(row int)
- func (tv *TableView) Top()
- type ToastMsg
- type ToggleBordersMsg
- type ToggleRowNumbersMsg
- type ViewMode
Constants ¶
const ( ActUp = "up" ActDown = "down" ActLeft = "left" ActRight = "right" ActTop = "top" ActBottom = "bottom" ActHalfUp = "half-up" ActHalfDown = "half-down" ActPageUp = "page-up" ActPageDown = "page-down" ActFirstCol = "first-col" ActLastCol = "last-col" ActSheet = "sheet" ActExpand = "expand" ActInfo = "info" ActRandom = "random" ActGoto = "goto" ActFuzzy = "fuzzy-search" ActExact = "exact-search" ActPalette = "palette" ActTabSwitch = "tab-switch" ActPrevTab = "prev-tab" ActNextTab = "next-tab" ActPop = "pop" ActQuit = "quit" ActHelp = "help" ActCopy = "copy" ActCopyCell = "copy-cell" ActCopyRow = "copy-row" ActSheetUp = "sheet-up" ActSheetDown = "sheet-down" ActBack = "back" ActEscBack = "esc-back" ActEdit = "edit" ActRefresh = "refresh" ActDelete = "delete" ActToggleSelect = "toggle-select" ActSheetFilter = "sheet-filter" ActJsonView = "json-view" ActNextPage = "next-page" ActPrevPage = "prev-page" ActColFocus = "col-focus" ActOobeCols = "oobe-cols" )
Semantic action names.
Variables ¶
var Factories = map[string]func(ctx AppContext, arg string) (Overlay, error){}
Factories maps command names to overlay constructors. Popup packages register themselves here from init(). A factory may return (nil, nil) for pure side-effect commands that need no overlay.
var GlobalBindings = []Binding{ {Keys: []string{"Q", "shift+q"}, Action: ActQuit, Help: "quit"}, {Keys: []string{"f1", "?"}, Action: ActHelp, Help: "help overlay"}, {Keys: []string{":"}, Action: ActPalette, Help: "command palette"}, {Keys: []string{"t"}, Action: ActTabSwitch, Help: "tab switcher"}, {Keys: []string{"H", "shift+h", "shift+left"}, Action: ActPrevTab, Help: "previous tab"}, {Keys: []string{"L", "shift+l", "shift+right"}, Action: ActNextTab, Help: "next tab"}, }
GlobalBindings apply in every non-overlay mode.
var SheetBindings = []Binding{ {Keys: []string{"down", "j"}, Action: ActSheetDown, Help: "next field"}, {Keys: []string{"up", "k"}, Action: ActSheetUp, Help: "prev field"}, {Keys: []string{"shift+down", "J", "shift+j"}, Action: ActSheetDown, Help: "next field"}, {Keys: []string{"shift+up", "K", "shift+k"}, Action: ActSheetUp, Help: "prev field"}, {Keys: []string{"c"}, Action: ActCopy, Help: "copy row"}, {Keys: []string{"e"}, Action: ActEdit, Help: "edit field"}, {Keys: []string{"r"}, Action: ActJsonView, Help: "view as JSON"}, {Keys: []string{"/"}, Action: ActSheetFilter, Help: "filter fields"}, {Keys: []string{"q", "esc"}, Action: ActBack, Help: "back to table"}, }
SheetBindings apply in sheet mode.
var TableBindings = []Binding{ {Keys: []string{"up", "k"}, Action: ActUp, Help: "row up"}, {Keys: []string{"down", "j"}, Action: ActDown, Help: "row down"}, {Keys: []string{"left", "h"}, Action: ActLeft, Help: "previous column"}, {Keys: []string{"right", "l"}, Action: ActRight, Help: "next column"}, {Keys: []string{"g", "home"}, Action: ActTop, Help: "first row"}, {Keys: []string{"G", "shift+g", "end"}, Action: ActBottom, Help: "last row"}, {Keys: []string{"ctrl+u"}, Action: ActHalfUp, Help: "half page up"}, {Keys: []string{"ctrl+j"}, Action: ActHalfDown, Help: "half page down"}, {Keys: []string{"pgup", "ctrl+b"}, Action: ActPageUp, Help: "page up"}, {Keys: []string{"pgdown", "ctrl+f"}, Action: ActPageDown, Help: "page down"}, {Keys: []string{"_"}, Action: ActFirstCol, Help: "first column"}, {Keys: []string{"$"}, Action: ActLastCol, Help: "last column"}, {Keys: []string{"enter"}, Action: ActSheet, Help: "open row sheet"}, {Keys: []string{"w"}, Action: ActExpand, Help: "toggle fit/wide columns"}, {Keys: []string{"i"}, Action: ActInfo, Help: "table info"}, {Keys: []string{"R", "shift+r"}, Action: ActRandom, Help: "random row"}, {Keys: []string{"r"}, Action: ActRefresh, Help: "refresh data"}, {Keys: []string{"1", "2", "3", "4", "5", "6", "7", "8", "9"}, Action: ActGoto, Help: "go to row"}, {Keys: []string{"y"}, Action: ActCopyCell, Help: "copy current cell"}, {Keys: []string{"Y", "shift+y"}, Action: ActCopyRow, Help: "copy row (tab-separated)"}, {Keys: []string{"/"}, Action: ActFuzzy, Help: "fuzzy search"}, {Keys: []string{"s"}, Action: ActExact, Help: "exact search"}, {Keys: []string{"q"}, Action: ActPop, Help: "pop frame / close tab"}, {Keys: []string{"esc"}, Action: ActEscBack, Help: "back / previous level"}, {Keys: []string{"ctrl+d"}, Action: ActDelete, Help: "delete row(s)"}, {Keys: []string{"space"}, Action: ActToggleSelect, Help: "toggle select"}, {Keys: []string{">"}, Action: ActNextPage, Help: "next page"}, {Keys: []string{"<"}, Action: ActPrevPage, Help: "prev page"}, {Keys: []string{"z"}, Action: ActColFocus, Help: "zoom current column (h/l to scroll)"}, {Keys: []string{"v"}, Action: ActOobeCols, Help: "select display columns (OpenObserve)"}, }
TableBindings apply in table mode.
Functions ¶
func Box ¶
Box frames content in a rounded border of total width w, with the title embedded in the top edge. Content lines are truncated/padded to fit.
func CloseOverlay ¶
CloseOverlay is a convenience command that emits CloseOverlayMsg.
func Composite ¶
Composite centers box over base within a w x h area, splicing the box into the base line by line. Both strings may contain ANSI escapes; splicing is width-aware. Base lines are padded (with spaces) to w and the base is padded to h lines so the overlay always lands where expected.
func FillPage ¶
FillPage centers box within a blank w x h area: every line is padded to exactly w cells and the area to exactly h lines, so a fullscreen page overlay lets nothing from the view behind it show through.
func FilterLine ¶
FilterLine renders the unified filter input line used across all views. When !filtering && filter=="" the caller should skip rendering this line. Hint is the placeholder text shown when filtering but no text typed yet.
func HighlightPad ¶
HighlightPad is like padLine but uses HighlightSubstr on the content before padding. The returned string already contains ANSI codes so ansi.StringWidth must be used (not len) when measuring it.
func HighlightRunes ¶
HighlightRunes wraps the rune positions listed in indices with matchStyle; all other runes use baseStyle. Indices must be valid 0-based rune positions in s.
func HighlightSubstr ¶
HighlightSubstr finds all case-insensitive occurrences of needle in s and wraps them with matchStyle; surrounding text uses baseStyle. Returns baseStyle.Render(s) when needle is empty or not found.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the root model: tabs of panes, an overlay stack, the search bar and the bottom status line.
func (*App) ActivePaneID ¶
func (*App) ColumnNames ¶
func (*App) CompletionSchema ¶
CompletionSchema builds the completion schema without ever blocking on the live connection: engine tables come from PRAGMA lookups against the in-memory database (cheap, safe on the update loop), live tables come from whatever WarmCompletionSchema has cached so far, and Current is the column set of the frame under view.
func (*App) CurrentFrame ¶
func (*App) CurrentRow ¶
func (*App) CurrentTableNamespace ¶
CurrentTableNamespace reports the namespace the active table was loaded from, so the refresh command can re-fetch the same table. It consults the completion cache's table-to-namespace map first, then falls back to the backend's connected namespace (when the backend exposes one), and finally returns "" (the backend then treats it as the default namespace).
func (*App) PendingDelete ¶
func (a *App) PendingDelete() *PendingDelete
PendingDelete reports the in-flight row delete awaiting commit, or nil when no delete is in progress.
func (*App) PendingEdit ¶
func (a *App) PendingEdit() *PendingEdit
PendingEdit reports the in-flight cell edit awaiting commit, or nil when no edit is in progress. Confirm popups read it to render the proposed change; the "saveedit" command consumes it.
func (*App) PushOverlay ¶
PushOverlay adds an overlay before the program starts. Database mode uses it to show the connection form on top of the empty workspace.
func (*App) SheetFieldCursor ¶
SheetFieldCursor reports the selected field index in sheet mode. It is always a valid column index for the current frame, or 0 when no pane is open.
func (*App) ShowBorders ¶
func (*App) ShowRowNumbers ¶
func (*App) TableNames ¶
func (*App) WarmCompletionSchema ¶
WarmCompletionSchema populates the live-connection side of the completion cache. It issues catalog queries and therefore blocks: call it only from inside a tea.Cmd goroutine, never on the update loop. With no arguments it fetches the namespace/table listing (once per connection); given table names it additionally fetches those tables' columns on first use. A replaced connection resets the cache automatically. File mode (no backend) is a no-op. Errors are swallowed: completion degrades to whatever is cached rather than interrupting typing.
type AppContext ¶
type AppContext interface {
CurrentFrame() *data.Frame // top of current pane stack (nil if no tabs)
CurrentRow() int // selected row in current table view
SheetFieldCursor() int // selected field in sheet mode
CurrentTableNamespace() string
BaseCrumb() string // current tab title
Crumbs() []string // full breadcrumb chain
ColumnNames() []string
Engine() *query.Engine // embedded SQL engine (may be nil in db mode)
TableNames() []string // engine-registered + backend tables for completion
Backend() db.Backend // nil in file mode
KV() db.KVBackend // nil unless redis mode
Theme() *theme.Theme
ThemeName() string
ShowBorders() bool
ShowRowNumbers() bool
Tabs() []TabInfo
ActiveTab() int
ActivePaneID() int // stable identity of the active pane (0 if no tabs)
PendingEdit() *PendingEdit
PendingDelete() *PendingDelete
}
AppContext is the read-only view of the application that popup factories receive. It exists so popup packages can be wired in without importing the app (avoiding cycles).
type ApplyFrameMsg ¶
type ApplyFrameMsg struct {
Frame *data.Frame
Crumb string
NewTab bool
TabTitle string
// PaneID identifies the pane the operation was started from (see
// AppContext.ActivePaneID). When set (non-zero) and NewTab is false the
// frame is pushed onto that pane even if the user has switched tabs while
// the command ran; if the pane is gone the frame opens as a new tab.
PaneID int
// RegisterAs, when non-empty, also registers Frame in the embedded SQL
// engine under this name (no-op in db mode), so imported tables are
// queryable by name like CLI-loaded ones.
RegisterAs string
// TableCols, when non-nil, limits which column indices the table view
// renders. Sheet/row-detail mode always shows all columns.
TableCols []int
}
ApplyFrameMsg pushes a derived frame onto a pane's stack, or opens it as a new tab when NewTab is set. Crumb is a short operation label ("filter", "query", "sort") shown in the breadcrumb.
type Binding ¶
Binding ties one or more key strings (tea.KeyPressMsg.String() forms) to a semantic action. The lists below are the single source of truth for both dispatch and the help overlay.
type CloseOverlayMsg ¶
type CloseOverlayMsg struct{}
CloseOverlayMsg pops the top overlay off the stack.
type CloseTabMsg ¶
type CloseTabMsg struct{ Index int }
CloseTabMsg closes the tab at Index; closing the last tab quits.
type CopyTextMsg ¶
type CopyTextMsg struct{ Text string }
CopyTextMsg copies text to the system clipboard via OSC52.
type ErrorMsg ¶
type ErrorMsg struct{ Err error }
ErrorMsg surfaces an error to the user in the error popup.
type ExecProcessMsg ¶
ExecProcessMsg runs an external program with the terminal released and resumes the app afterwards. OnDone (optional) converts the process error into a follow-up message.
type FullscreenOverlay ¶
type FullscreenOverlay interface{ Fullscreen() bool }
FullscreenOverlay marks an overlay that renders as a full page: it covers the whole body area instead of floating over it. Database mode uses it to make the connection form, the schema/key browsers and the value viewer feel like a page stack (login -> browser -> table) rather than popups over the table.
type JumpToRowMsg ¶
type JumpToRowMsg struct{ Row int }
JumpToRowMsg selects a row (0-based) in the current table view.
type JumpToTabMsg ¶
type JumpToTabMsg struct{ Index int }
JumpToTabMsg activates the tab at Index (0-based, clamped).
type OobeColsSelectedMsg ¶
type OobeColsSelectedMsg struct{ Columns []string }
OobeColsSelectedMsg updates the active pane TableCols after the user picks columns.
type Options ¶
type Options struct {
Frames []reader.NamedFrame // initial tabs (already engine-registered)
Engine *query.Engine // embedded SQL engine (nil in db mode)
Backend db.Backend // live SQL connection (nil in file mode)
KV db.KVBackend // live redis connection (nil otherwise)
ThemeName string
ShowBorders bool
ShowRowNumbers bool
}
Options configures a new App.
type Overlay ¶
type Overlay interface {
// Update handles a message and returns the (possibly replaced) overlay.
Update(msg tea.Msg) (Overlay, tea.Cmd)
// View renders the overlay box for the given available area.
View(width, height int, th *theme.Theme) string
}
Overlay is a modal component rendered on top of the main view. The app keeps a stack of overlays; only the top one receives key input.
type OverlayIniter ¶
OverlayIniter is an optional extension of Overlay: an overlay that needs to kick off an asynchronous command as soon as it is shown (loading data, scanning keys, ...) implements Init. The app runs the returned command right after pushing the overlay.
type Pane ¶
type Pane struct {
Title string
Table TableView
Mode ViewMode
SheetOff int // left-list scroll offset (key column)
SheetField int // cursored field index in sheet mode
// SheetValOff is the right-pane value scroll offset within the cursored
// field. It is reset to 0 each time the cursor moves to a new field.
SheetValOff int
// SheetEditing is true while the sheet view is inline-editing the
// cursored field. The "e" key toggles it on; saveedit/canceledit clear it.
SheetEditing bool
// SheetEdit holds the runes typed during an inline sheet edit.
SheetEdit []rune
// SheetEditCur is the rune cursor within SheetEdit.
SheetEditCur int
// SheetFilter holds the current field-filter pattern typed after "/".
// SheetField is always interpreted as an index INTO the matched set
// (sheetMatchedCols), not a raw column index; with an empty filter the
// matched set is every column so the two coincide.
SheetFilter []rune
SheetFiltering bool
// JsonViewOff is the scroll offset when viewing a row as JSON.
JsonViewOff int
// SortCol is the column name currently sorted on ("" = unsorted).
// SortAsc is true for ascending order, false for descending.
SortCol string
SortAsc bool
ColZoomed bool // true when user zoomed into a single column via z key
// TableCols, when non-nil, restricts which columns the table view renders.
// Sheet/row-detail mode always shows all columns regardless of this field.
TableCols []int
// HScroll is the character-level horizontal offset applied to the last
// TableCols column so the user can pan within wide content (e.g. body).
HScroll int
// contains filtered or unexported fields
}
Pane is one tab: a stack of frames (base + one per applied operation), a table view state and a sheet scroll offset.
func (*Pane) Crumbs ¶
Crumbs returns the breadcrumb chain: tab title, then one label per derived frame.
func (*Pane) ID ¶
ID returns the pane's stable unique identity (positive; 0 is never used, so it can act as an "unset" marker in messages).
func (*Pane) Pop ¶
Pop removes the top frame. It reports false when the stack is already at its base (the caller then closes the tab instead).
func (*Pane) ReplaceBase ¶
ReplaceBase swaps the pane's base frame (stack[0]) and re-clamps the view onto it, used by the refresh command to reload the current table.
type PendingDelete ¶
PendingDelete captures one or more rows awaiting deletion. The app populates it from the multi-select set (or the single cursor row) and commits it via the "deleterows" command.
type PendingEdit ¶
type PendingEdit struct {
Frame *data.Frame
Row int
Col int
ColName string
OldValue string
NewValue string
Table string
Namespace string
}
PendingEdit captures an in-flight cell edit awaiting confirmation. The popup that collects the new value populates this and the app commits it via the "saveedit" command.
type PushOverlayMsg ¶
type PushOverlayMsg struct{ Overlay Overlay }
PushOverlayMsg pushes a new overlay onto the stack.
type RegisterTableMsg ¶
type RegisterTableMsg struct{ Name string }
RegisterTableMsg registers the current frame in the SQL engine under Name.
type RenderOpts ¶
type RenderOpts struct {
Width, Height int
Theme *theme.Theme
ShowBorders bool
ShowRowNumbers bool
MatchRows map[int]bool // rows emphasized with the match style
SortCol string // currently sorted column name ("" = unsorted)
SortAsc bool // true = ASC indicator, false = DESC indicator
HeaderCur int // column index to highlight in header (-1 or 0+ valid)
// SeverityCol, when non-empty, names a column whose value determines the row foreground color.
// Values matching TRACE/DEBUG/INFO/WARN/ERROR/FATAL (case-insensitive) get distinct colors.
SeverityCol string
// TableCols, when non-nil, renders only these column indices.
// Sheet mode passes nil here so all columns are always visible in detail.
TableCols []int
// NoEllipsis disables the "…" truncation indicator on cell values —
// text is hard-clipped at the column boundary instead.
NoEllipsis bool
// HighlightQuery, when non-empty, highlights matching substrings in cell values.
HighlightQuery string
// HighlightCols restricts highlighting to these column indices (nil = all cols).
HighlightCols []int
// HScroll is the character-level horizontal scroll offset applied to the
// last visible column. Used when TableCols is set to let the user pan
// within a single wide column (e.g. OpenObserve body) with h/l keys.
HScroll int
}
RenderOpts carries everything Render needs besides the frame.
type ReplaceBaseMsg ¶
ReplaceBaseMsg swaps the base frame of the pane identified by PaneID (or the active pane when zero), used by the refresh command to reload the current table without opening a new tab.
type ResetStackMsg ¶
type ResetStackMsg struct{}
ResetStackMsg pops the current pane back to its base frame.
type RunCommandMsg ¶
RunCommandMsg invokes a named command. Built-in names (quit, reset, toggleborders, togglerownumbers, reloadconfig) are handled by the app directly; everything else is resolved through the Factories registry.
type SearchBar ¶
type SearchBar struct {
// contains filtered or unexported fields
}
SearchBar implements live search over the current frame. While active it keeps a preview frame (the filtered rows) that the app displays instead of the pane's top frame; the stack is only touched on commit.
func (*SearchBar) Backspace ¶
func (s *SearchBar) Backspace()
Backspace removes the last rune and recomputes the preview.
func (*SearchBar) Cancel ¶
func (s *SearchBar) Cancel()
Cancel deactivates the bar and drops the preview.
func (*SearchBar) Commit ¶
Commit deactivates the bar and returns the filtered frame plus a crumb label. ok is false when there is nothing to commit (empty query).
func (*SearchBar) Paste ¶
Paste appends pasted text as a single edit (bracketed paste delivers the whole chunk in one message, not per-rune key presses), flattened to one line first.
func (*SearchBar) Preview ¶
Preview returns the frame to display while the bar is active (never nil while active with a base frame).
func (*SearchBar) StartCols ¶
StartCols activates the bar over frame f, restricting the search to the given column indices (nil = search all columns).
type SetBackendMsg ¶
SetBackendMsg attaches a live database connection to a running app. Database mode starts the UI with no connection and wires one in after the connection form succeeds. Nil fields are left untouched.
type SetPageMsg ¶
type SetPageMsg struct{ Page int }
SetPageMsg navigates to a specific page in paginated results.
type SetQueryParamsMsg ¶
SetQueryParamsMsg sets time range, page, and page size on an OpenObserve backend and triggers a single table refresh.
type SetThemeMsg ¶
type SetThemeMsg struct{ Name string }
SetThemeMsg switches the active theme by built-in name.
type SetTimeRangeMsg ¶
type SetTimeRangeMsg struct{ Minutes int }
SetTimeRangeMsg sets the time range for OpenObserve queries.
type TableView ¶
type TableView struct {
// contains filtered or unexported fields
}
TableView holds the scroll/selection state of one table widget. Rendering is stateless apart from remembering the last page size for paging keys.
func (*TableView) ClampTo ¶
ClampTo clamps selection and cursor to the bounds of f (used when the underlying frame changes but position should be roughly kept). A frame change invalidates the multi-select set, so it is cleared here too.
func (*TableView) ClearSelect ¶
func (tv *TableView) ClearSelect()
ClearSelect empties the multi-select set.
func (*TableView) HalfPageDown ¶
func (*TableView) HalfPageUp ¶
func (*TableView) IsSelected ¶
IsSelected reports whether a row is in the multi-select set.
func (*TableView) LastCol ¶
LastCol moves the column cursor to the last column and requests that it be scrolled into view (wide mode).
func (*TableView) NextCol ¶
NextCol / PrevCol / FirstCol move the column cursor (both column modes) and request that it be scrolled into view (wide mode).
func (*TableView) PageSize ¶
PageSize is the number of body rows shown at the last render (fallback 10).
func (*TableView) Render ¶
func (tv *TableView) Render(f *data.Frame, o RenderOpts) string
Render draws the table into a Width x Height cell area.
func (*TableView) Reset ¶
func (tv *TableView) Reset()
Reset returns the view to the top-left with row 0 selected and re-arms the automatic column-mode pick for the next frame shown.
func (*TableView) SelectedRows ¶
SelectedRows returns the multi-select members in ascending order. The returned slice is freshly allocated; callers may mutate it freely.
func (*TableView) SetColCursor ¶
SetColCursor sets the column cursor to the given index (clamped to valid range).
func (*TableView) ToggleExpanded ¶
func (tv *TableView) ToggleExpanded()
ToggleExpanded flips the column mode manually; the choice sticks for the frame currently shown (no later auto-pick overrides it).
func (*TableView) ToggleSelect ¶
ToggleSelect adds a row to (or removes it from) the multi-select set. The set is lazy-initialized on first use so an untouched view stays allocation free.
type ToastMsg ¶
type ToastMsg struct{ Text string }
ToastMsg shows a transient success/info message at the bottom.
type ToggleBordersMsg ¶
type ToggleBordersMsg struct{}
ToggleBordersMsg flips the table border toggle.
type ToggleRowNumbersMsg ¶
type ToggleRowNumbersMsg struct{}
ToggleRowNumbersMsg flips the row-number gutter toggle.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dbmode wires the live-database mode into the UI: the mysql / postgres / redis subcommands start an empty workspace with a connection form overlay on top, then browse schemas, tables and keys through the shared overlay system.
|
Package dbmode wires the live-database mode into the UI: the mysql / postgres / redis subcommands start an empty workspace with a connection form overlay on top, then browse schemas, tables and keys through the shared overlay system. |
|
Package plot renders pure-text charts (histograms, scatter plots) for the UI.
|
Package plot renders pure-text charts (histograms, scatter plots) for the UI. |
|
Confirm-delete overlay: prompts the user to commit or cancel a pending row delete.
|
Confirm-delete overlay: prompts the user to commit or cancel a pending row delete. |