ui

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Accent         = lipgloss.Color("37")
	AccentInactive = lipgloss.Color("245")
	Black          = lipgloss.Color("234")
)
View Source
var DefaultTheme = Theme{
	Bg:              lipgloss.Color("235"),
	Fg:              lipgloss.Color("252"),
	Muted:           lipgloss.Color("243"),
	Accent:          Accent,
	AccentInactive:  AccentInactive,
	Success:         lipgloss.Color("2"),
	Danger:          lipgloss.Color("1"),
	Warning:         lipgloss.Color("3"),
	FooterBg:        Accent,
	FooterFg:        Black,
	SidebarBg:       lipgloss.Color("236"),
	NavBg:           lipgloss.Color("235"),
	NavFg:           Accent,
	NavActiveBg:     Accent,
	NavActiveFg:     Black,
	SidebarHeaderBg: lipgloss.Color("237"),
	SidebarHeaderFg: lipgloss.Color("252"),
}

Functions

func ClipboardWrite

func ClipboardWrite(data []byte)

func ClipboardWriteString

func ClipboardWriteString(data string)

func Run

func Run(ctx context.Context, opts Options) error

Types

type Content

type Content struct {
	Tabs Tabs
	// contains filtered or unexported fields
}

func NewContent

func NewContent(theme Theme) Content

func (Content) ActiveResultData

func (c Content) ActiveResultData() ResultData

func (Content) ActiveText

func (c Content) ActiveText() string

func (*Content) AddTab

func (c *Content) AddTab()

func (*Content) Blur

func (c *Content) Blur()

func (*Content) BlurResults

func (c *Content) BlurResults()

func (*Content) ClearActive

func (c *Content) ClearActive()

func (*Content) CloseTab

func (c *Content) CloseTab()

func (Content) CurrentRow

func (c Content) CurrentRow() (headers []string, values []string, ok bool)

func (*Content) Focus

func (c *Content) Focus()

func (*Content) FocusResults

func (c *Content) FocusResults()

func (*Content) GoToTab

func (c *Content) GoToTab(n int)

func (Content) HasResults

func (c Content) HasResults() bool

func (*Content) NextTab

func (c *Content) NextTab()

func (*Content) PrevTab

func (c *Content) PrevTab()

func (*Content) Resize

func (c *Content) Resize(width, height int)

func (*Content) ResultsEnsureVisible

func (c *Content) ResultsEnsureVisible(height int)

func (*Content) ResultsMoveDown

func (c *Content) ResultsMoveDown()

func (*Content) ResultsMoveUp

func (c *Content) ResultsMoveUp()

func (*Content) ResultsScrollLeft

func (c *Content) ResultsScrollLeft()

func (*Content) ResultsScrollRight

func (c *Content) ResultsScrollRight()

func (*Content) SetActiveText

func (c *Content) SetActiveText(text string)

func (*Content) SetResult

func (c *Content) SetResult(data ResultData)

func (*Content) SetTabs

func (c *Content) SetTabs(tabs []TabItem)

func (*Content) Update

func (c *Content) Update(msg tea.Msg) tea.Cmd

func (Content) View

func (c Content) View(width, height int) string

type ExplainView

type ExplainView struct {
	// contains filtered or unexported fields
}

func NewExplainView

func NewExplainView(theme Theme) ExplainView

func (*ExplainView) Clear

func (e *ExplainView) Clear()

func (ExplainView) HasContent

func (e ExplainView) HasContent() bool

func (*ExplainView) ScrollDown

func (e *ExplainView) ScrollDown(height, width int)

func (*ExplainView) ScrollUp

func (e *ExplainView) ScrollUp()

func (*ExplainView) SetError

func (e *ExplainView) SetError(msg string)

func (*ExplainView) SetResult

func (e *ExplainView) SetResult(result plugin.BrowserExplainResult)

func (ExplainView) View

func (e ExplainView) View(width, height int) string

type FocusArea

type FocusArea int
const (
	FocusEditor FocusArea = iota
	FocusTree
	FocusResults
)
type Footer struct {
	QueryStart time.Time
	QueryDone  bool
	QueryMs    int64
	Running    bool
	// contains filtered or unexported fields
}

func NewFooter

func NewFooter(theme Theme) Footer

func (*Footer) Tick

func (f *Footer) Tick()

func (Footer) View

func (f Footer) View(width int, label string) string

type Help

type Help struct {
	Visible bool
	// contains filtered or unexported fields
}

func NewHelp

func NewHelp(theme Theme) Help

func (Help) View

func (h Help) View(width, height int) string
type NavItem int
const (
	NavDatabase NavItem = iota
	NavExplain
)
type Navbar struct {
	Active NavItem
	// contains filtered or unexported fields
}

func NewNavbar

func NewNavbar(theme Theme) Navbar
func (n Navbar) ActiveTitle() string
func (n *Navbar) Next()
func (n *Navbar) Prev()
func (n Navbar) View(height int) string

type Options

type Options struct {
	RawDriver string
	RawDSN    string
	Registry  *plugins.Registry
	Version   string
}

type ResultData

type ResultData struct {
	Headers     []string
	Rows        [][]string
	ColumnTypes []string
}

type Results

type Results struct {
	// contains filtered or unexported fields
}

func NewResults

func NewResults(theme Theme) Results

func (Results) CurrentRow

func (r Results) CurrentRow() (headers []string, values []string, ok bool)

func (*Results) EnsureVisible

func (r *Results) EnsureVisible(height int)

func (Results) HasData

func (r Results) HasData() bool

func (*Results) MoveDown

func (r *Results) MoveDown()

func (*Results) MoveUp

func (r *Results) MoveUp()

func (*Results) Resize

func (r *Results) Resize(width, height int)

func (*Results) ScrollLeft

func (r *Results) ScrollLeft()

func (*Results) ScrollRight

func (r *Results) ScrollRight()

func (*Results) SetData

func (r *Results) SetData(data ResultData)

func (Results) View

func (r Results) View(width, height int, focused bool) string

type RowDetail

type RowDetail struct {
	Visible bool
	// contains filtered or unexported fields
}

func NewRowDetail

func NewRowDetail(theme Theme) RowDetail

func (*RowDetail) Close

func (r *RowDetail) Close()

func (*RowDetail) Copy

func (r *RowDetail) Copy()

func (*RowDetail) JumpNext

func (r *RowDetail) JumpNext()

JumpNext jumps to the next column header.

func (*RowDetail) JumpPrev

func (r *RowDetail) JumpPrev()

JumpPrev jumps to the previous column header.

func (*RowDetail) Open

func (r *RowDetail) Open(headers, values []string)

func (*RowDetail) ScrollDown

func (r *RowDetail) ScrollDown(totalLines, visible int)

ScrollDown scrolls one line down and updates colCursor.

func (*RowDetail) ScrollLeft

func (r *RowDetail) ScrollLeft()

func (*RowDetail) ScrollRight

func (r *RowDetail) ScrollRight()

func (*RowDetail) ScrollUp

func (r *RowDetail) ScrollUp()

ScrollUp scrolls one line up and updates colCursor.

func (RowDetail) View

func (r RowDetail) View(width, height int) string
type Sidebar struct {
	Title   string
	Version string
	Tree    Tree
	// contains filtered or unexported fields
}

func NewSidebar

func NewSidebar(theme Theme) Sidebar

func (Sidebar) View

func (s Sidebar) View(width, height int) string

type TUI

type TUI struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) TUI

func (TUI) Init

func (t TUI) Init() tea.Cmd

func (*TUI) LoadData

func (t *TUI) LoadData(ctx context.Context) error

func (TUI) Update

func (t TUI) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (TUI) View

func (t TUI) View() string

type TabItem

type TabItem struct {
	Title    string
	Content  string
	Modified bool
}

type Tabs

type Tabs struct {
	Items   []TabItem
	Active  int
	Focused bool
	// contains filtered or unexported fields
}

func NewTabs

func NewTabs(theme Theme) Tabs

func (Tabs) View

func (t Tabs) View(width int) string

type Theme

type Theme struct {
	Bg              lipgloss.Color
	Fg              lipgloss.Color
	Muted           lipgloss.Color
	Accent          lipgloss.Color
	AccentInactive  lipgloss.Color
	Success         lipgloss.Color
	Danger          lipgloss.Color
	Warning         lipgloss.Color
	FooterBg        lipgloss.Color
	FooterFg        lipgloss.Color
	SidebarBg       lipgloss.Color
	NavBg           lipgloss.Color
	NavFg           lipgloss.Color
	NavActiveBg     lipgloss.Color
	NavActiveFg     lipgloss.Color
	SidebarHeaderBg lipgloss.Color
	SidebarHeaderFg lipgloss.Color
}

type Tree

type Tree struct {
	Items   []TreeItem
	Cursor  int
	Focused bool
	// contains filtered or unexported fields
}

func NewTree

func NewTree(theme Theme) Tree

func (*Tree) AdvanceSpinner

func (t *Tree) AdvanceSpinner()

func (*Tree) Collapse

func (t *Tree) Collapse()

func (*Tree) CursorExpandable

func (t *Tree) CursorExpandable() bool

func (*Tree) CursorIDPath

func (t *Tree) CursorIDPath() []string

func (*Tree) CursorLabel

func (t *Tree) CursorLabel() string

func (Tree) CursorPath

func (t Tree) CursorPath() ([]string, bool)

CursorPath returns the full path of labels from root to the currently selected item.

func (*Tree) EnsureVisible

func (t *Tree) EnsureVisible(height int)

func (*Tree) Expand

func (t *Tree) Expand()

func (*Tree) IsLoading

func (t *Tree) IsLoading() bool

func (*Tree) MoveDown

func (t *Tree) MoveDown()

func (*Tree) MoveUp

func (t *Tree) MoveUp()

func (*Tree) SetLoaded

func (t *Tree) SetLoaded(ids []string, children []TreeItem)

func (*Tree) StartLoading

func (t *Tree) StartLoading() ([]string, bool)

StartLoading marks the cursor item as loading if it is expandable and not yet loaded. Returns the full path of IDs from root to the item, and true if loading was started.

func (Tree) View

func (t Tree) View(width, height int) string

type TreeItem

type TreeItem struct {
	ID         string
	Label      string
	Children   []TreeItem
	Expandable bool
	Expanded   bool
	Loaded     bool
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL