tui

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STRING = "string"
	LIST   = "list"
	SET    = "set"
	ZSET   = "zset"
	HASH   = "hash"
	STREAM = "stream"
)
View Source
const MARGIN = 2

Variables

This section is empty.

Functions

func CreateRedisClient added in v0.2.0

func CreateRedisClient(conn string, username string, password string, db int) (*redis.Client, error)

func RunTUI

func RunTUI(redis_opts RedisOptions, model_opts ModelOptions)

func StringArrOut

func StringArrOut(arr *[]string, width int) string

Types

type Details

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

func (*Details) Init

func (dm *Details) Init() tea.Cmd

func (*Details) Reset

func (dm *Details) Reset()

func (*Details) Update

func (dm *Details) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Details) View

func (dm *Details) View() string

type Model

type Model struct {
	ScanCursor int
	Node       Node
	// contains filtered or unexported fields
}

func InitialModel added in v0.2.0

func InitialModel(
	redis *redis.Client,
	model_opts ModelOptions,
) *Model

func (*Model) GetDetails

func (m *Model) GetDetails(node *Node) tea.Cmd

set details depending on the type of the key

func (*Model) Init

func (m *Model) Init() tea.Cmd

func (*Model) Scan

func (m *Model) Scan() tea.Cmd

scan redis db using the search string

func (*Model) Update

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

func (*Model) UpdateSize

func (m *Model) UpdateSize(width int, height int)

func (*Model) View

func (m *Model) View() string

type ModelOptions added in v0.2.1

type ModelOptions struct {
	PrettyPrintJson bool
	IncludeTypes    bool
	ScanSize        int64
	Delimiter       string
}

type Node

type Node struct {
	Children  []*Node
	Value     string
	FullKey   string
	RedisType string
	Expanded  bool
}

func (*Node) AddChild

func (n *Node) AddChild(key []string, full string, client *redis.Client, search_string string, tb *type_builder)

recursively add a child node to the tree

func (*Node) GenNodes added in v0.2.1

func (n *Node) GenNodes(keys []string, client *redis.Client, search string, opts ModelOptions)

func (*Node) Print

func (n *Node) Print(padding int) string

type PrintItem

type PrintItem struct {
	Node  *Node
	Depth int
}

func GeneratePrintList

func GeneratePrintList(root_node *Node, depth int) []*PrintItem

convert the tree to a list of PrintItems

func (*PrintItem) Print

func (pi *PrintItem) Print() string

type RT

type RT string

type RedisHash

type RedisHash struct {
	RedisType RT
	Data      map[string]string
}

func GenerateHashType

func GenerateHashType(client *redis.Client, node *Node) *RedisHash

func (*RedisHash) Print

func (rh *RedisHash) Print(table_width int) string

type RedisList

type RedisList struct {
	RedisType RT
	Data      []string
}

func GenerateListType

func GenerateListType(client *redis.Client, node *Node) *RedisList

func (*RedisList) Print

func (rl *RedisList) Print(table_width int) string

type RedisOptions added in v0.2.2

type RedisOptions struct {
	Address  string
	Username string
	Password string
	DB       int
}

type RedisSet

type RedisSet struct {
	RedisType RT
	Data      []string
}

func GenerateSetType

func GenerateSetType(client *redis.Client, node *Node) *RedisSet

func (*RedisSet) Print

func (rs *RedisSet) Print(table_width int) string

type RedisStream

type RedisStream struct {
	RedisType RT
	Data      []redis.XMessage
}

func GenerateStreamType

func GenerateStreamType(client *redis.Client, node *Node) *RedisStream

func (*RedisStream) Print

func (rh *RedisStream) Print(table_width int) string

type RedisString

type RedisString struct {
	RedisType       RT
	Data            string
	PrettyPrintJson bool
}

func GenerateStringType

func GenerateStringType(client *redis.Client, node *Node, pretty_print_json bool) *RedisString

func (*RedisString) Print

func (rs *RedisString) Print(table_width int) string

type RedisType

type RedisType interface {
	Print(table_width int) string
}

type RedisZSet

type RedisZSet struct {
	RedisType RT
	Data      []string
}

func GenerateZSetType

func GenerateZSetType(client *redis.Client, node *Node) *RedisZSet

func (*RedisZSet) Print

func (gzs *RedisZSet) Print(table_width int) string
type Search struct {
	// contains filtered or unexported fields
}

func NewSearch

func NewSearch() *Search

func (*Search) Init

func (s *Search) Init() tea.Cmd

func (*Search) ToggleActive

func (s *Search) ToggleActive(active bool)

func (*Search) Update

func (s *Search) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*Search) View

func (s *Search) View() string

type TablePrintList

type TablePrintList struct {
	List []*PrintItem
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *TablePrintList

func (*TablePrintList) GetCurrent

func (pl *TablePrintList) GetCurrent() *Node

return a pointer to the current node

func (*TablePrintList) GetRows

func (pl *TablePrintList) GetRows() []table.Row

return a list of rows to be displayed in the table

func (*TablePrintList) Init

func (pl *TablePrintList) Init() tea.Cmd

func (*TablePrintList) ResetCursor

func (pl *TablePrintList) ResetCursor() tea.Msg

func (*TablePrintList) Update

func (pl *TablePrintList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*TablePrintList) View

func (pl *TablePrintList) View() string

Jump to

Keyboard shortcuts

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