DtTable

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DtCell

type DtCell cdp.Pair[rune, tcell.Style]

DtCell represents a cell in a data table.

func NewDtCell

func NewDtCell(content rune, style tcell.Style) *DtCell

NewDtCell creates a new DtCell with the given content and style.

Parameters:

  • content: The content of the cell.
  • style: The style of the cell.

Returns:

  • *DtCell: A pointer to the new DtCell.

type DtRow

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

DtRow represents a row in a data table. It is safe for concurrent use.

func NewDtRow

func NewDtRow(width int) (*DtRow, error)

NewDtRow creates a new DtRow with the given width all initialized to nil.

Parameters:

  • width: The width of the row.

Returns:

  • *DtRow: A pointer to the new DtRow.
  • error: An error of type *ers.ErrInvalidParameter if the width is less than 0.

func (*DtRow) Append

func (r *DtRow) Append(cells ...*DtCell)

Append appends the given cells to the row.

Parameters:

  • cells: The cells to append.

func (*DtRow) GetCellAt

func (r *DtRow) GetCellAt(x int) *DtCell

GetCellAt returns the cell at the given index. If the index is out of bounds, it returns nil.

Parameters:

  • x: The x-coordinate of the cell.

Returns:

  • *DtCell: The cell at the given index.

func (*DtRow) GetWidth

func (r *DtRow) GetWidth() int

GetWidth returns the width of the row.

Returns:

  • int: The width of the row.

func (*DtRow) Resize

func (r *DtRow) Resize(newWidth int) error

Resize resizes the row to the given width.

Parameters:

  • newWidth: The new width of the row.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if the new width is less than 0.

func (*DtRow) SetCell

func (r *DtRow) SetCell(cell *DtCell, x int) error

SetCell sets the cell at the given index.

Parameters:

  • cell: The cell to set.
  • x: The x-coordinate of the cell.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if the index is out of bounds.

func (*DtRow) SetCells

func (r *DtRow) SetCells(cells []*DtCell, from int) error

SetCells sets the cells at the given index.

Parameters:

  • cells: The cells to set.
  • from: The index to start setting the cells.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if cells cannot be set at the given index.

type DtTable

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

DtTable represents a table of cells. It is safe for concurrent use.

func NewDtTable

func NewDtTable(height, width int) (*DtTable, error)

NewDtTable creates a new table with the given height and width.

Parameters:

  • height: The height of the table.
  • width: The width of the table.

Returns:

  • *DtTable: A pointer to the new table.
  • error: An error of type *ers.ErrInvalidParameter if height or width is less than 0.

func TransformIntoTable

func TransformIntoTable(highlights []DtCell) (*DtTable, error)

TransformIntoTable transforms a slice of cells into a table.

Parameters:

  • highlights: The slice of cells to transform.

Returns:

  • *DtTable: A pointer to the new table.
  • error: An error of type *ErrInvalidCharacter if an invalid character is found.

func (*DtTable) Close

func (dt *DtTable) Close()

Close closes the table.

func (*DtTable) GetCellAt

func (dt *DtTable) GetCellAt(x, y int) *DtCell

GetCellAt returns the cell at the given coordinates. If the coordinates are out of bounds, it returns nil.

Parameters:

  • x: The x-coordinate.
  • y: The y-coordinate.

Returns:

  • *DtCell: The cell at the given coordinates.

func (*DtTable) GetHeight

func (dt *DtTable) GetHeight() int

GetHeight returns the height of the table.

Returns:

  • int: The height of the table.

func (*DtTable) GetModifyChan

func (dt *DtTable) GetModifyChan() <-chan bool

GetModifyChan returns the signal buffer's signal channel.

Returns:

  • <-chan bool: The signal channel.

func (*DtTable) GetWidth

func (dt *DtTable) GetWidth() int

GetWidth returns the width of the table.

Returns:

  • int: The width of the table.

func (*DtTable) ResizeHeight

func (dt *DtTable) ResizeHeight(newHeight int) error

ResizeHeight resizes the height of the table.

Parameters:

  • newHeight: The new height of the table.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if newHeight is less than 0.

func (*DtTable) ResizeWidth

func (dt *DtTable) ResizeWidth(newWidth int) error

ResizeWidth resizes the width of the table.

Parameters:

  • newWidth: The new width of the table.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if newWidth is less than 0.

func (*DtTable) SetCellAt

func (dt *DtTable) SetCellAt(x, y int, cell *DtCell) error

SetCellAt sets the cell at the given coordinates.

Parameters:

  • x: The x-coordinate.
  • y: The y-coordinate.
  • cell: The cell to set.

Returns:

  • error: An error of type *ers.ErrInvalidParameter if x and y are out of bounds.

func (*DtTable) SignalChange

func (dt *DtTable) SignalChange()

SignalChange signals a change to the table.

func (*DtTable) Wait

func (dt *DtTable) Wait()

Wait waits for the table to close.

type WriteOnlyDTer

type WriteOnlyDTer interface {
	// GetCellAt returns the cell at the given coordinates.
	// If the coordinates are out of bounds, it returns nil.
	//
	// Parameters:
	//   - x: The x-coordinate.
	//   - y: The y-coordinate.
	//
	// Returns:
	//   - *DtCell: The cell at the given coordinates.
	GetCellAt(x, y int) *DtCell

	// GetWidth returns the width of the table.
	//
	// Returns:
	//   - int: The width of the table.
	GetWidth() int

	// GetHeight returns the height of the table.
	//
	// Returns:
	//   - int: The height of the table.
	GetHeight() int

	// SetCellAt sets the cell at the given coordinates.
	//
	// Parameters:
	//   - x: The x-coordinate.
	//   - y: The y-coordinate.
	//   - cell: The cell to set.
	//
	// Returns:
	//   - error: An error of type *ers.ErrInvalidParameter if x and y are out of bounds.
	SetCellAt(x, y int, cell *DtCell) error

	// SignalChange signals a change to the table.
	SignalChange()
}

Jump to

Keyboard shortcuts

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