tui

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// KeyMapping maps keyboard operations to their hotkeys. In the future, this part can be customized by the user configuration.
	KeyMapping = map[KeyOp]tcell.Key{
		KeySourcesOp: tcell.KeyCtrlA,
		KeySchemasOp: tcell.KeyCtrlS,
		KeyTablesOp:  tcell.KeyCtrlD,
		KeyPreviewOp: tcell.KeyCtrlE,
		KeyQueryOp:   tcell.KeyCtrlQ,
	}

	// TitleSourcesView is the title for Sources view.
	TitleSourcesView = fmt.Sprintf("Sources [ %s ]", tcell.KeyNames[KeyMapping[KeySourcesOp]])
	// TitleSchemasView is the title for Schemas view.
	TitleSchemasView = fmt.Sprintf("Schemas [ %s ]", tcell.KeyNames[KeyMapping[KeySchemasOp]])
	// TitleTablesView is the title for Tables view.
	TitleTablesView = fmt.Sprintf("Tables [ %s ]", tcell.KeyNames[KeyMapping[KeyTablesOp]])
	// TitlePreviewView is the title for Preview view.
	TitlePreviewView = fmt.Sprintf("Preview [ %s ]", tcell.KeyNames[KeyMapping[KeyPreviewOp]])
	// TitleQueryView is the title for Query view.
	TitleQueryView = fmt.Sprintf("Query [ %s ]", tcell.KeyNames[KeyMapping[KeyQueryOp]])
	// TitleFooterView is the title for Footer view.
	TitleFooterView = "Navigate [ Tab / Shift-Tab ] · Focus [ Ctrl-F ] · Exit [ Ctrl-C ] \n Tables specific: Describe [ e ] · Preview [ p ]"
)

Functions

This section is empty.

Types

type KeyOp

type KeyOp int16

KeyOp defines dbui specific hotkey operations.

const (
	// KeySourcesOp is the operation corresponding to the activation of the Sources view.
	KeySourcesOp KeyOp = iota
	// KeySchemasOp is the operation corresponding to the activation of the Schemas view.
	KeySchemasOp
	// KeyTablesOp is the operation corresponding to the activation of the Tables view.
	KeyTablesOp
	// KeyPreviewOp is the operation corresponding to the activation of the Preview view.
	KeyPreviewOp
	// KeyQueryOp is the operation corresponding to the activation of the Query view.
	KeyQueryOp
)

type TUI

type TUI struct {

	// View components.
	App          *tview.Application
	Grid         *tview.Grid
	Sources      *tview.List
	Schemas      *tview.List
	Tables       *tview.List
	PreviewTable *tview.Table
	QueryInput   *tview.InputField
	FooterText   *tview.TextView
	// contains filtered or unexported fields
}

TUI implement terminal user interface features. It also provides easy-to-use, easy-to-access abstraction over underlying tview components.

func NewTUI added in v0.2.0

func NewTUI(appConfig internal.AppConfig, dataController internal.DataController) *TUI

NewTUI configures and returns an instance of terminal user interface.

func (*TUI) LoadData

func (tui *TUI) LoadData()

LoadData prepares user interface components based on their data sources.

func (*TUI) Start

func (tui *TUI) Start() error

Start starts terminal user interface application.

Jump to

Keyboard shortcuts

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