Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

table source pure

Functions 1

func New

1func New(header []string, rows [][]string) (*Table, error)
source

New creates a new Table instance, ensuring the header and rows match in size

Types 1

type Table

struct
1type Table struct {
2	header []string
3	rows   [][]string
4}
source

Table defines the structure for a markdown table

Methods on Table

func AddColumn

method on Table
1func (t *Table) AddColumn(header string, values []string) error
source

AddColumn adds a new column to the table with the specified values

func AddRow

method on Table
1func (t *Table) AddRow(row []string) error
source

AddRow adds a new row to the table

func RemoveColumn

method on Table
1func (t *Table) RemoveColumn(index int) error
source

RemoveColumn removes a column from the table by its index

func RemoveRow

method on Table
1func (t *Table) RemoveRow(index int) error
source

RemoveRow removes a row from the table by its index

func String

method on Table
1func (t *Table) String() string
source

Table returns a markdown string for the given Table

func Validate

method on Table
1func (t *Table) Validate() error
source

Validate checks if the number of columns in each row matches the number of columns in the header

Imports 2

Source Files 3