Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlignCenter ¶
type AlignCenter string
AlignCenter is a string based Cell that aligns to the center.
func (*AlignCenter) Len ¶
func (a *AlignCenter) Len() int
Len returns the length of the underlying string.
func (*AlignCenter) Pad ¶
func (a *AlignCenter) Pad(l int)
Pad instructs the AlignCenter to add spaces to pad both the start and end of the string. If the string needs to pad an odd number the extra space goes to the end of the string.
func (*AlignCenter) String ¶
func (a *AlignCenter) String() string
String will return the underlying string.
type AlignLeft ¶
type AlignLeft string
AlignLeft is a string based Cell that aligns left (pads to the right).
type AlignRight ¶
type AlignRight string
AlignRight is a string based Cell that aligns right (pads to the left).
func (*AlignRight) Len ¶
func (a *AlignRight) Len() int
Len returns the length of the underlying string.
func (*AlignRight) Pad ¶
func (a *AlignRight) Pad(l int)
Pad instructs the AlignRight to add spaces to the left.
func (*AlignRight) String ¶
func (a *AlignRight) String() string
String will return the underlying string.
type Cell ¶
type Cell interface { // Pad called when the Table wishes to adjust the Cell size. Pad(size int) // Len is called when a Table is calculating the Cell sizes before padding. Len() int // String will return a string repesentation of the Cell. String() string } //interface
Cell is the data in the Row and thus Table.
type Row ¶
type Row struct { // contains filtered or unexported fields } //struct
Row is a single row in a Table and contains columns of Cells.
func NewRow ¶
NewRow returns a Row with the provided default column size. Use this when the number of columns is known when the Row is constructed.
func (*Row) Adjust ¶
Adjust will loop through all the columns and attempt to pad the Cells using the provided lengths. The number of lengths is expected to match the number of columns/Cells in the Row
type Table ¶
type Table struct { // contains filtered or unexported fields } //struct
Table contains all the Rows (and Cells).
func New ¶
New creates a new Table with the provided default row size. Use this when the number of rows is knows when the Table is constructed.
func (*Table) Adjust ¶
func (t *Table) Adjust()
Adjust will calculate the max column(Cell) length and the instruct all Cells to pad to the longest column.