tui

package
v0.306.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ActionTargetQueryID requires a query_id before the action can run.
	ActionTargetQueryID = ActionRequirement{/* contains filtered or unexported fields */}
	// ActionTargetTransactionID requires a transaction_id before the action can run.
	ActionTargetTransactionID = ActionRequirement{/* contains filtered or unexported fields */}
	// ActionTargetConnectionID requires a connection_id before the action can run.
	ActionTargetConnectionID = ActionRequirement{/* contains filtered or unexported fields */}
)
View Source
var (
	// PostgresConnectionView presents live connections with Postgres session semantics.
	PostgresConnectionView = ConnectionViewProfile{
							// contains filtered or unexported fields
	}
	// VitessConnectionView presents live connections with Vitess processlist semantics.
	VitessConnectionView = ConnectionViewProfile{
							// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type ActionRequirement

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

ActionRequirement describes the row identifier required before an action can be offered for a selected connection. A zero requirement means the action is not available for the connection source.

type CaptureControl

type CaptureControl struct {
	Open   CaptureOpener
	Writer *history.CaptureWriter
	Path   string
}

func (*CaptureControl) Close

func (c *CaptureControl) Close() error

type CaptureOpener

type CaptureOpener func() (*history.CaptureWriter, string, error)

type ConnectionCapabilities

type ConnectionCapabilities struct {
	CancelQuery          ActionRequirement
	TerminateTransaction ActionRequirement
	TerminateConnection  ActionRequirement
	ShowBlockers         bool
	// contains filtered or unexported fields
}

ConnectionCapabilities is the TUI capability contract for a connection source. It tells the view which selected-row IDs are needed for each action, whether blocker navigation should be shown, and which action controls should be visible.

It does not execute actions; the model still calls ConnectionsClient. The support value only gates visible controls and validates that the selected row has the identifier the backend expects.

func DefaultConnectionCapabilities

func DefaultConnectionCapabilities() ConnectionCapabilities

DefaultConnectionCapabilities is the Postgres capability set. A zero ConnectionCapabilities also resolves to this default so existing tests and model construction keep Postgres behavior unless a source opts into different capabilities.

type ConnectionViewProfile

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

func (ConnectionViewProfile) DefaultSort

func (p ConnectionViewProfile) DefaultSort() live.SortMode

DefaultSort is the sort order a connection source should use for this view.

type ConnectionsClient

type ConnectionsClient interface {
	List(context.Context, live.SortMode) (live.ConnectionList, error)
	CancelQuery(context.Context, live.ActionTarget) error
	TerminateTransaction(context.Context, live.ActionTarget) error
	TerminateConnection(context.Context, live.ActionTarget) error
}

ConnectionsClient is the live-connections data + action dependency the view model talks to. Production wires this to the wire-level *live.Client (directly or through a filtering wrapper); tests provide a stub that records calls.

type Model

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

Model is the Bubble Tea view model for the interactive table.

func NewModel

func NewModel(ctx context.Context, client ConnectionsClient, interval, duration time.Duration) Model

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

func (Model) WithCaptureControl

func (m Model) WithCaptureControl(control *CaptureControl) Model

func (Model) WithCaptureHistory

func (m Model) WithCaptureHistory(h *history.CaptureHistory) Model

WithCaptureHistory replaces the default in-memory ring with one preloaded by the caller, used by replay mode to seed the model with every captured snapshot up front. The cursor points at the latest capture, rendering reflects it immediately, and the model starts paused so the operator controls advance via the step keybindings instead of an auto-tick chewing through the trace.

func (Model) WithCaptureWriter

func (m Model) WithCaptureWriter(w *history.CaptureWriter) Model

WithCaptureWriter persists every successful list to the capture trace file while the TUI runs. Returns the model unchanged when w is nil.

func (Model) WithConnectionView

func (m Model) WithConnectionView(profile ConnectionViewProfile) Model

func (Model) WithFilter

func (m Model) WithFilter(filter string) Model

WithFilter records the active row filter (e.g. "filter: role=primary") so the header can show that the view is scoped. Empty when no filter is active.

func (Model) WithReadOnlyActions

func (m Model) WithReadOnlyActions(message string) Model

func (Model) WithTarget

func (m Model) WithTarget(target Target) Model

type Target

type Target struct {
	Database string
	Branch   string
	Keyspace string
	Shard    string
}

Jump to

Keyboard shortcuts

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