tui

package
v0.44.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	LoadBufferSize:      100,
	SearchHistorySize:   100,
	LoadingIndicatorLag: 500 * time.Millisecond,
}

Functions

func AddressParser

func AddressParser(s string) (map[string]any, error)

func AttributeParser

func AttributeParser(s string) (map[string]any, error)

func CIDParser

func CIDParser(s string) (any, error)

func HasBuckets

func HasBuckets(ctx context.Context, db *bbolt.DB, path [][]byte) (bool, error)

HasBuckets checks if a bucket has nested buckets. It relies on assumption that a bucket can have either nested buckets or records but not both.

func LoadBuckets

func LoadBuckets(
	ctx context.Context, db *bbolt.DB, path [][]byte, bufferSize int,
) (<-chan Item[*Bucket], error)

func LoadRecords

func LoadRecords(
	ctx context.Context, db *bbolt.DB, path [][]byte, bufferSize int,
) (<-chan Item[*Record], error)

func OIDParser

func OIDParser(s string) (any, error)

func OpenDB

func OpenDB(path string, writable bool) (*bbolt.DB, error)

Types

type Bucket

type Bucket struct {
	Name       []byte
	Path       [][]byte
	Entry      common.SchemaEntry
	NextParser common.Parser
}

type BucketsView

type BucketsView struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewBucketsView

func NewBucketsView(ui *UI, filter *Filter) *BucketsView

func (*BucketsView) Draw

func (v *BucketsView) Draw(screen tcell.Screen)

func (*BucketsView) InputHandler

func (v *BucketsView) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*BucketsView) Mount

func (v *BucketsView) Mount(_ context.Context) error

func (*BucketsView) Unmount

func (v *BucketsView) Unmount()

func (*BucketsView) Update

func (v *BucketsView) Update(ctx context.Context) error

type Config

type Config struct {
	LoadBufferSize      int
	SearchHistorySize   int
	LoadingIndicatorLag time.Duration
}

type DetailedView

type DetailedView struct {
	*tview.TextView
}

func NewDetailedView

func NewDetailedView(detailed string) *DetailedView

func (*DetailedView) Mount

func (v *DetailedView) Mount(_ context.Context) error

func (*DetailedView) Unmount

func (v *DetailedView) Unmount()

func (*DetailedView) Update

func (v *DetailedView) Update(_ context.Context) error

type Filter

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

func NewFilter

func NewFilter(values map[string]any) *Filter

func (*Filter) Apply

func (f *Filter) Apply(e common.SchemaEntry) *Filter

func (*Filter) Result

func (f *Filter) Result() common.FilterResult

type HelpPage

type HelpPage struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewHelpPage

func NewHelpPage(filters []string, hints map[string]string) *HelpPage

func (*HelpPage) Draw

func (hp *HelpPage) Draw(screen tcell.Screen)

func (*HelpPage) InputHandler

func (hp *HelpPage) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*HelpPage) MouseHandler

func (hp *HelpPage) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

type InputFieldWithHistory

type InputFieldWithHistory struct {
	*tview.InputField
	// contains filtered or unexported fields
}

func NewInputFieldWithHistory

func NewInputFieldWithHistory(historyLimit int) *InputFieldWithHistory

func (*InputFieldWithHistory) AddToHistory

func (f *InputFieldWithHistory) AddToHistory(s string)

func (*InputFieldWithHistory) InputHandler

func (f *InputFieldWithHistory) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

type Item

type Item[T any] struct {
	// contains filtered or unexported fields
}

type LoadingBar

type LoadingBar struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewLoadingBar

func NewLoadingBar(needDrawFunc func()) *LoadingBar

func (*LoadingBar) Draw

func (b *LoadingBar) Draw(screen tcell.Screen)

func (*LoadingBar) Start

func (b *LoadingBar) Start(ctx context.Context)

func (*LoadingBar) Stop

func (b *LoadingBar) Stop()

type Primitive

type Primitive interface {
	tview.Primitive

	Mount(ctx context.Context) error
	Update(ctx context.Context) error
	Unmount()
}

type Record

type Record struct {
	Key, Value []byte
	Path       [][]byte
	Entry      common.SchemaEntry
}

type RecordsView

type RecordsView struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewRecordsView

func NewRecordsView(ui *UI, bucket *Bucket, filter *Filter) *RecordsView

func (*RecordsView) Draw

func (v *RecordsView) Draw(screen tcell.Screen)

func (*RecordsView) GetInnerRect

func (v *RecordsView) GetInnerRect() (int, int, int, int)

func (*RecordsView) InputHandler

func (v *RecordsView) InputHandler() func(event *tcell.EventKey, _ func(p tview.Primitive))

func (*RecordsView) Mount

func (v *RecordsView) Mount(ctx context.Context) error

func (*RecordsView) Unmount

func (v *RecordsView) Unmount()

func (*RecordsView) Update

func (v *RecordsView) Update(ctx context.Context) error

type UI

type UI struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewUI

func NewUI(
	ctx context.Context,
	app *tview.Application,
	db *bbolt.DB,
	rootParser common.Parser,
	cfg *Config,
) *UI

func (*UI) AddCompositeFilter

func (ui *UI) AddCompositeFilter(
	typ string,
	parser func(string) (map[string]any, error),
	helpHint string,
) error

func (*UI) AddFilter

func (ui *UI) AddFilter(
	typ string,
	parser func(string) (any, error),
	helpHint string,
) error

func (*UI) Draw

func (ui *UI) Draw(screen tcell.Screen)

func (*UI) InputHandler

func (ui *UI) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

func (*UI) WithPrompt

func (ui *UI) WithPrompt(prompt string) error

Jump to

Keyboard shortcuts

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