Documentation
¶
Index ¶
- type Table
- func (t *Table) AllRows() []row.Row[string]
- func (t *Table) AppendFields(fields ...string)
- func (t *Table) AppendLine(line string)
- func (t *Table) AppendRow(row []string)
- func (t *Table) AppendRows(rows [][]string)
- func (t *Table) AppendRuler(r ruler.Ruler)
- func (t *Table) AppendText(text string)
- func (t *Table) DataRow(n int) row.Row[string]
- func (t *Table) DataRows() []row.Row[string]
- func (t *Table) FromString(in string) *Table
- func (t *Table) InitColumnNames(names []string)
- func (t *Table) InitFlags(flags []column.Flags)
- func (t *Table) InitPrefix(prefix string)
- func (t *Table) LineCount() int
- func (t Table) MarshalJSON() ([]byte, error)
- func (t *Table) MarshalText() ([]byte, error)
- func (t *Table) Row(n int) row.Row[string]
- func (t *Table) RowCount() int
- func (t *Table) RulerCount() int
- func (t *Table) String() string
- func (t *Table) TextlineCount() int
- func (t *Table) UnmarshalText(in []byte) error
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 ¶
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 (*Table) AppendLine ¶
func (*Table) AppendRows ¶
func (*Table) AppendRuler ¶
func (*Table) AppendText ¶
func (*Table) DataRow ¶
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 ¶
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 (*Table) InitColumnNames ¶ added in v0.4.16
func (*Table) InitPrefix ¶
func (Table) MarshalJSON ¶
func (*Table) MarshalText ¶
func (*Table) Row ¶
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