table

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

Alignment is the alignment of a table cell.

const (
	// Left aligns to the left.
	Left Alignment = iota
	// Right align to the right.
	Right
	// Center centers.
	Center
)

type CellType

type CellType int

CellType is the type of a table cell.

type Row

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

Row is a table row.

func (*Row) AddEmpty

func (r *Row) AddEmpty() *Row

AddEmpty adds an empty cell.

func (*Row) AddIndented

func (r *Row) AddIndented(content string, indent int) *Row

AddIndented adds an indented cell.

func (*Row) AddNumber

func (r *Row) AddNumber(n decimal.Decimal) *Row

AddNumber adds a number cell.

func (*Row) AddText

func (r *Row) AddText(content string, align Alignment) *Row

AddText adds a text cell.

func (*Row) FillEmpty

func (r *Row) FillEmpty()

FillEmpty fills the row with empty cells.

type SeparatorCell

type SeparatorCell struct{}

SeparatorCell is a cell containing a separator.

type Table

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

Table is a matrix of table cells.

func New

func New(groups ...int) *Table

New creates a new table with column groups.

func (*Table) AddEmptyRow

func (t *Table) AddEmptyRow()

AddEmptyRow adds a separator row.

func (*Table) AddRow

func (t *Table) AddRow() *Row

AddRow adds a row.

func (*Table) AddSeparatorRow

func (t *Table) AddSeparatorRow()

AddSeparatorRow adds a separator row.

func (*Table) Width

func (t *Table) Width() int

Width returns the width of this table.

type TextRenderer

type TextRenderer struct {
	Color     bool
	Thousands bool
	Round     int32
	// contains filtered or unexported fields
}

TextRenderer renders a table to text.

func (*TextRenderer) Render

func (r *TextRenderer) Render(t *Table, w io.Writer) error

Render renders this table to a string.

Jump to

Keyboard shortcuts

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