Documentation ¶
Index ¶
- type DtCell
- type DtRow
- type DtTable
- func (dt *DtTable) Close()
- func (dt *DtTable) GetCellAt(x, y int) *DtCell
- func (dt *DtTable) GetHeight() int
- func (dt *DtTable) GetModifyChan() <-chan bool
- func (dt *DtTable) GetWidth() int
- func (dt *DtTable) ResizeHeight(newHeight int) error
- func (dt *DtTable) ResizeWidth(newWidth int) error
- func (dt *DtTable) SetCellAt(x, y int, cell *DtCell) error
- func (dt *DtTable) SignalChange()
- func (dt *DtTable) Wait()
- type WriteOnlyDTer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 ¶
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 ¶
Append appends the given cells to the row.
Parameters:
- cells: The cells to append.
func (*DtRow) GetCellAt ¶
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) Resize ¶
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 ¶
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.
type DtTable ¶
type DtTable struct {
// contains filtered or unexported fields
}
DtTable represents a table of cells. It is safe for concurrent use.
func NewDtTable ¶
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 ¶
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) GetCellAt ¶
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 ¶
GetHeight returns the height of the table.
Returns:
- int: The height of the table.
func (*DtTable) GetModifyChan ¶
GetModifyChan returns the signal buffer's signal channel.
Returns:
- <-chan bool: The signal channel.
func (*DtTable) GetWidth ¶
GetWidth returns the width of the table.
Returns:
- int: The width of the table.
func (*DtTable) ResizeHeight ¶
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 ¶
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 ¶
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.
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() }