table

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Table

type Table struct {
	layout.Layout
	Prefix     string
	StringRows [][]string
	column.Index
	Rulers    overlay.Overlay[ruler.Ruler]
	TextLines overlay.Overlay[string]
}

func (*Table) AllRows

func (t *Table) AllRows() []row.Row[string]

AllRows returns all of a table's rows.

The rows returned always includes the first row, even if it was used to derive the table's column names.

See also Table.DataRows

func (*Table) AppendFields

func (t *Table) AppendFields(fields ...string)

func (*Table) AppendLine

func (t *Table) AppendLine(line string)

func (*Table) AppendRow

func (t *Table) AppendRow(row []string)

func (*Table) AppendRows

func (t *Table) AppendRows(rows [][]string)

func (*Table) AppendRuler

func (t *Table) AppendRuler(r ruler.Ruler)

func (*Table) AppendText

func (t *Table) AppendText(text string)

func (*Table) DataRow

func (t *Table) DataRow(n int) row.Row[string]

DataRow returns a single row of a table as a struct able to access the row's fields by name. See row.Row.

The index used to access the row is offset by 1, so that DataRow(0) returns the second row of the underlying Strings slice.

See also Table.Row

func (*Table) DataRows

func (t *Table) DataRows() []row.Row[string]

DataRows returns all of the table's data rows.

The returned rows will include the first row only if [WithColumnNames] was used.

Otherwise, the first row is assumed to be a header row, containing column names instead of data, and is not included in the returned list.

See also Table.AllRows

func (*Table) FromString

func (t *Table) FromString(in string) *Table

func (*Table) InitColumnNames added in v0.4.16

func (t *Table) InitColumnNames(names []string)

func (*Table) InitFlags

func (t *Table) InitFlags(flags []column.Flags)

func (*Table) InitPrefix

func (t *Table) InitPrefix(prefix string)

func (*Table) LineCount

func (t *Table) LineCount() int

func (Table) MarshalJSON

func (t Table) MarshalJSON() ([]byte, error)

func (*Table) MarshalText

func (t *Table) MarshalText() ([]byte, error)

func (*Table) Row

func (t *Table) Row(n int) row.Row[string]

Row returns a single row of a table as a struct able to access the row's fields by name. See row.Row.

No rows are skipped and the first row has the index `0`.

See also Table.DataRow

func (*Table) RowCount

func (t *Table) RowCount() int

func (*Table) RulerCount

func (t *Table) RulerCount() int

func (*Table) String

func (t *Table) String() string

func (*Table) TextlineCount

func (t *Table) TextlineCount() int

func (*Table) UnmarshalText added in v0.4.16

func (t *Table) UnmarshalText(in []byte) error

Jump to

Keyboard shortcuts

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