interactive

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBlockMetaPage

func NewBlockMetaPage(state *State) *interactive.GenericPage

func NewObjectDataPage

func NewObjectDataPage(state *State) *interactive.GenericPage

func NewObjectMetaPage

func NewObjectMetaPage(state *State) *interactive.GenericPage

func Run

func Run(path string) error

Run runs the interactive interface

func RunBubbletea

func RunBubbletea(path string) error

RunBubbletea runs interactive interface using Bubbletea

func RunBubbleteaWithOptions

func RunBubbleteaWithOptions(path string, opts *ViewOptions) error

RunBubbleteaWithOptions runs interactive interface with options

func RunUnified

func RunUnified(ctx context.Context, path string, opts *ViewOptions) error

RunUnified runs the object viewer using the unified GenericPage framework

Types

type BlkSummary

type BlkSummary struct {
	BlockID          uint32
	TotalOriginSize  uint32
	TotalCompSize    uint32
	CompressionRatio float64
}

BlkSummary contains summary information for a block

type BlockMetaProvider

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

func (*BlockMetaProvider) GetOverview

func (p *BlockMetaProvider) GetOverview() string

func (*BlockMetaProvider) GetRowNums

func (p *BlockMetaProvider) GetRowNums() []string

func (*BlockMetaProvider) GetRows

func (p *BlockMetaProvider) GetRows() [][]string

type ColInfo

type ColInfo struct {
	Idx  uint16
	Name string
	Type types.Type
}

ColInfo contains column information

type ColumnExpander

type ColumnExpander struct {
	SourceCol  uint16          // Source column index to expand
	NewCols    []string        // New column names
	NewTypes   []types.Type    // New column types
	ExpandFunc func(any) []any // Function to expand value into multiple values
}

ColumnExpander defines how to expand a column into multiple columns

type ColumnsCommand

type ColumnsCommand struct {
	ShowAll bool
	Columns []uint16
}

ColumnsCommand is the column filter command

func (*ColumnsCommand) Execute

func (c *ColumnsCommand) Execute(state *State) (string, bool, error)

type Command

type Command interface {
	Execute(state *State) (output string, quit bool, err error)
}

Command is the command interface

func ParseCommand

func ParseCommand(input string) (Command, error)

ParseCommand parses a command

type FormatCommand

type FormatCommand struct {
	ColIdx        uint16
	FormatterName string
}

FormatCommand sets format

func (*FormatCommand) Execute

func (c *FormatCommand) Execute(state *State) (string, bool, error)

type GotoCommand

type GotoCommand struct {
	Top    bool
	Bottom bool
	Block  uint32 // block number
}

GotoCommand is the goto command

func (*GotoCommand) Execute

func (c *GotoCommand) Execute(state *State) (string, bool, error)

type HelpCommand

type HelpCommand struct {
	Topic string
}

HelpCommand is the help command

func (*HelpCommand) Execute

func (c *HelpCommand) Execute(state *State) (string, bool, error)

type ObjSummary

type ObjSummary struct {
	TotalRows        uint64
	TotalNullCnt     uint64
	TotalOriginSize  uint64
	TotalCompSize    uint64
	CompressionRatio float64
}

ObjSummary contains summary information for an object

type ObjectDataHandler

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

func (*ObjectDataHandler) FilterRow

func (h *ObjectDataHandler) FilterRow(row []string, filter string) bool

func (*ObjectDataHandler) MatchRow

func (h *ObjectDataHandler) MatchRow(row []string, query string) bool

func (*ObjectDataHandler) OnBack

func (h *ObjectDataHandler) OnBack() tea.Cmd

func (*ObjectDataHandler) OnCustomKey

func (h *ObjectDataHandler) OnCustomKey(key string) tea.Cmd

func (*ObjectDataHandler) OnSelect

func (h *ObjectDataHandler) OnSelect(rowIdx int) tea.Cmd

type ObjectDataProvider

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

func (*ObjectDataProvider) GetOverview

func (p *ObjectDataProvider) GetOverview() string

func (*ObjectDataProvider) GetRowNums

func (p *ObjectDataProvider) GetRowNums() []string

func (*ObjectDataProvider) GetRows

func (p *ObjectDataProvider) GetRows() [][]string

type ObjectMetaProvider

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

func (*ObjectMetaProvider) GetOverview

func (p *ObjectMetaProvider) GetOverview() string

func (*ObjectMetaProvider) GetRowNums

func (p *ObjectMetaProvider) GetRowNums() []string

func (*ObjectMetaProvider) GetRows

func (p *ObjectMetaProvider) GetRows() [][]string

type ObjectUnifiedModel

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

ObjectUnifiedModel uses GenericPage for object viewing

func NewObjectUnifiedModel

func NewObjectUnifiedModel(ctx context.Context, reader *objecttool.ObjectReader, opts *ViewOptions) *ObjectUnifiedModel

NewObjectUnifiedModel creates a new unified model for object viewing

func (*ObjectUnifiedModel) ClearObjectToOpen

func (m *ObjectUnifiedModel) ClearObjectToOpen()

ClearObjectToOpen clears the object to open

func (*ObjectUnifiedModel) GetObjectToOpen

func (m *ObjectUnifiedModel) GetObjectToOpen() string

GetObjectToOpen returns the object path to open (if any)

func (*ObjectUnifiedModel) Init

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

func (*ObjectUnifiedModel) Update

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

func (*ObjectUnifiedModel) View

func (m *ObjectUnifiedModel) View() string

type QuitCommand

type QuitCommand struct{}

QuitCommand is the quit command

func (*QuitCommand) Execute

func (c *QuitCommand) Execute(state *State) (string, bool, error)

type RenameCommand

type RenameCommand struct {
	ColIndex uint16
	NewName  string
}

RenameCommand renames a column

func (*RenameCommand) Execute

func (c *RenameCommand) Execute(state *State) (string, bool, error)

type SchemaCommand

type SchemaCommand struct{}

SchemaCommand shows schema

func (*SchemaCommand) Execute

func (c *SchemaCommand) Execute(state *State) (string, bool, error)

type ScrollCommand

type ScrollCommand struct {
	Down  bool
	Lines int
}

ScrollCommand is the scroll command

func (*ScrollCommand) Execute

func (c *ScrollCommand) Execute(state *State) (string, bool, error)

type SearchCommand

type SearchCommand struct {
	Pattern string
}

loadHistory loads command history SearchCommand is the search command

func (*SearchCommand) Execute

func (c *SearchCommand) Execute(state *State) (string, bool, error)

type SearchMatch

type SearchMatch struct {
	Row        int64
	Col        int
	Value      string
	RowNum     string // Row number display (block-offset)
	ColumnName string // Column name
}

type SetCommand

type SetCommand struct {
	Option string
	Value  int
}

SetCommand sets options

func (*SetCommand) Execute

func (c *SetCommand) Execute(state *State) (string, bool, error)

type State

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

State represents the browsing state

func NewState

func NewState(ctx context.Context, reader *objecttool.ObjectReader) *State

func (*State) AllRows

func (s *State) AllRows() ([][]string, []string, error)

AllRows returns all rows (loading all blocks)

func (*State) ClearObjectToOpen

func (s *State) ClearObjectToOpen()

ClearObjectToOpen clears the object to open

func (*State) Close

func (s *State) Close()

Close closes the state

func (*State) Columns

func (s *State) Columns() []objecttool.ColInfo

Columns returns column information based on current mode

func (*State) CurrentRows

func (s *State) CurrentRows() ([][]string, []string, error)

CurrentRows returns the current page data (formatted strings) Returns: rows, rowNumbers, error

func (*State) FilteredRowCount

func (s *State) FilteredRowCount() int64

FilteredRowCount returns the number of rows after filtering

func (*State) GetBlockStartRow

func (s *State) GetBlockStartRow(blockIdx uint32) int64

GetBlockStartRow returns the starting row number for a block

func (*State) GetObjectToOpen

func (s *State) GetObjectToOpen() string

GetObjectToOpen returns the object path to open (if any)

func (*State) GlobalRowOffset

func (s *State) GlobalRowOffset() int64

GlobalRowOffset returns current global row offset

func (*State) GotoBlock

func (s *State) GotoBlock(blockIdx uint32) error

GotoBlock jumps to specified block

func (*State) GotoRow

func (s *State) GotoRow(globalRow int64) error

GotoRow jumps to specified row (global row number)

func (*State) NextPage

func (s *State) NextPage() error

NextPage moves to the next page

func (*State) PrevPage

func (s *State) PrevPage() error

PrevPage moves to the previous page

func (*State) ScrollDown

func (s *State) ScrollDown() error

ScrollDown scrolls down one line

func (*State) ScrollUp

func (s *State) ScrollUp() error

ScrollUp scrolls up one line

func (*State) SetFormat

func (s *State) SetFormat(colIdx uint16, formatterName string) error

SetFormat sets column format

func (*State) SetRowRange

func (s *State) SetRowRange(start, end int64)

SetRowRange sets the row range filter

func (*State) SwitchToBlkMeta

func (s *State) SwitchToBlkMeta() error

func (*State) SwitchToData

func (s *State) SwitchToData()

func (*State) SwitchToObjMeta

func (s *State) SwitchToObjMeta() error

type SwitchModeCommand

type SwitchModeCommand struct {
	Mode ViewMode
}

SwitchModeCommand switches view mode

func (*SwitchModeCommand) Execute

func (c *SwitchModeCommand) Execute(state *State) (string, bool, error)

type VRowsCommand

type VRowsCommand struct {
	Rows int
}

VRowsCommand sets number of rows to display in vertical mode

func (*VRowsCommand) Execute

func (c *VRowsCommand) Execute(state *State) (string, bool, error)

type VerticalCommand

type VerticalCommand struct {
	Enable bool
}

VerticalCommand switches vertical/table mode

func (*VerticalCommand) Execute

func (c *VerticalCommand) Execute(state *State) (string, bool, error)

type View

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

View is a simplified terminal view

func NewView

func NewView() *View

func (*View) Render

func (v *View) Render(state *State, message string) error

Render renders the current state

type ViewMode

type ViewMode int

ViewMode represents the current view mode

const (
	ViewModeData ViewMode = iota
	ViewModeBlkMeta
	ViewModeObjMeta
)

type ViewOptions

type ViewOptions struct {
	StartRow       int64                        // Start row (0-based)
	EndRow         int64                        // End row (inclusive, -1 means all)
	ColumnNames    map[uint16]string            // Custom column names
	ColumnFormats  map[uint16]string            // Custom column formats (e.g., "ts", "objectstats", "hex")
	ColumnExpander *ColumnExpander              // Column expander for splitting columns
	ObjectNameCol  int                          // Column index containing object name for drill-down (-1 to disable)
	BaseDir        string                       // Base directory for opening nested objects
	CustomOverview func(rows [][]string) string // Custom overview function
}

ViewOptions contains options for viewing object data

Jump to

Keyboard shortcuts

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