table

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 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 Renderer added in v0.0.4

type Renderer struct {
	Table     *Table
	Color     bool
	Thousands bool
	Round     int32
	// contains filtered or unexported fields
}

Renderer renders a table to text.

func NewConsoleRenderer added in v0.0.4

func NewConsoleRenderer(t *Table, enableColor bool, thousands bool, round int32) *Renderer

NewConsoleRenderer returns a new console renderer.

func (*Renderer) Render added in v0.0.4

func (r *Renderer) Render(w io.Writer) error

Render renders this table to a string.

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 added in v0.0.4

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.

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.

Jump to

Keyboard shortcuts

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