table

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: BSD-2-Clause Imports: 4 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 {
	CellSeparator  string
	PrintHeader    func(io.Writer, string) error
	PrintSeparator func(io.Writer, string) error
	PrintData      func(io.Writer, int, string) error
	PrintFooter    func(io.Writer, string) error
	// contains filtered or unexported fields
}

Table contains data for a table to be printed.

func New

func New() *Table

New initializes a new Table

func (*Table) AddColumn

func (t *Table) AddColumn(header, format string)

AddColumn adds a new header field with the header and format, which is expected to be template string compatible with text/template. When compiling the format fails, AddColumn panics.

func (*Table) AddFooter

func (t *Table) AddFooter(line string)

AddFooter prints line after the table

func (*Table) AddRow

func (t *Table) AddRow(data interface{})

AddRow adds a new row to the table, which is filled with data.

func (*Table) Write

func (t *Table) Write(w io.Writer) error

Write prints the table to w.

Jump to

Keyboard shortcuts

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