...
Package table
Variables
var DefaultTableStyle = TableStyle{
Padding: 1,
VerticalBorders: true,
HorizontalBorders: true,
MaxTableWidth: 120,
MaxColWidth: 40,
EnableTextStyling: true,
}
type AlignType uint
const (
AlignTypeLeft AlignType = iota
AlignTypeCenter
AlignTypeRight
)
type Cell struct {
Contents []string
Style string
Align AlignType
}
func C
¶
func C(contents string, args ...interface{}) Cell
func (Cell) Width
¶
func (c Cell) Width() (int, int)
type Divider string
type Row struct {
Cells []Cell
Divider string
Style string
}
func R
¶
func R(args ...interface{}) *Row
func (r *Row) AppendCell(cells ...Cell) *Row
func (r *Row) Render(widths []int, totalWidth int, tableStyle TableStyle, isLastRow bool) string
type Table struct {
Rows []*Row
TableStyle TableStyle
}
func NewTable() *Table
func (t *Table) AppendRow(row *Row) *Table
func (*Table) Render
¶
func (t *Table) Render() string
type TableStyle struct {
Padding int
VerticalBorders bool
HorizontalBorders bool
MaxTableWidth int
MaxColWidth int
EnableTextStyling bool
}