Documentation ¶
Overview ¶
Create & Generate text based table
Index ¶
- Constants
- func ConditionString(cond bool, valid, inValid string) string
- func DisplayWidth(str string) int
- func Pad(s, pad string, width int) string
- func PadLeft(s, pad string, width int) string
- func PadRight(s, pad string, width int) string
- func Title(name string) string
- func WrapString(s string, lim int) ([]string, int)
- func WrapWords(words []string, spc, lim, pen int) [][]string
- type Table
- func (t *Table) Append(row []string)
- func (t *Table) AppendBulk(rows [][]string)
- func (t Table) Render()
- func (t *Table) SetAlignment(align int)
- func (t *Table) SetAutoFormatHeaders(auto bool)
- func (t *Table) SetAutoWrapText(auto bool)
- func (t *Table) SetBorder(border bool)
- func (t *Table) SetCenterSeparator(sep string)
- func (t *Table) SetColWidth(width int)
- func (t *Table) SetColumnSeparator(sep string)
- func (t *Table) SetFooter(keys []string)
- func (t *Table) SetHeader(keys []string)
- func (t *Table) SetHeaderLine(line bool)
- func (t *Table) SetRowLine(line bool)
- func (t *Table) SetRowSeparator(sep string)
Constants ¶
const ( CENTRE = "+" ROW = "-" COLUMN = "|" SPACE = " " )
const ( ALIGN_DEFAULT = iota ALIGN_CENTRE ALIGN_RIGHT ALIGN_LEFT )
const (
MAX_ROW_WIDTH = 30
)
Variables ¶
This section is empty.
Functions ¶
func ConditionString ¶
Simple Condition for string Returns value based on condition
func DisplayWidth ¶
func WrapString ¶
Wrap wraps s into a paragraph of lines of length lim, with minimal raggedness.
func WrapWords ¶
WrapWords is the low-level line-breaking algorithm, useful if you need more control over the details of the text wrapping process. For most uses, WrapString will be sufficient and more convenient.
WrapWords splits a list of words into lines with minimal "raggedness", treating each rune as one unit, accounting for spc units between adjacent words on each line, and attempting to limit lines to lim units. Raggedness is the total error over all lines, where error is the square of the difference of the length of the line and lim. Too-long lines (which only happen when a single word is longer than lim units) have pen penalty units added to the error.
Types ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func NewCSVReader ¶
Start a New Table Writer with csv.Reader
This enables customisation such as reader.Comma = ';' See http://golang.org/src/pkg/encoding/csv/reader.go?s=3213:3671#L94
func (*Table) AppendBulk ¶
Allow Support for Bulk Append Eliminates repeated for loops
func (*Table) SetAutoFormatHeaders ¶
Turn header autoformatting on/off. Default is on (true).
func (*Table) SetAutoWrapText ¶
Turn automatic multiline text adjustment on/off. Default is on (true).
func (*Table) SetCenterSeparator ¶
Set the center Separator
func (*Table) SetColumnSeparator ¶
Set the Column Separator
func (*Table) SetHeaderLine ¶
Set Header Line This would enable / disable a line after the header
func (*Table) SetRowLine ¶
Set Row Line This would enable / disable a line on each row of the table