Documentation
¶
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 Border
- 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) SetAutoMergeCells(auto bool)
- func (t *Table) SetAutoWrapText(auto bool)
- func (t *Table) SetBorder(border bool)
- func (t *Table) SetBorders(border Border)
- func (t *Table) SetCenterSeparator(sep string)
- func (t *Table) SetColWidth(width int)
- func (t *Table) SetFooter(keys []string)
- func (t *Table) SetFooterAlignment(fAlign int)
- func (t *Table) SetHeader(keys []string)
- func (t *Table) SetHeaderAlignment(hAlign int)
- func (t *Table) SetHeaderLine(line bool)
- func (t *Table) SetNewLine(nl string)
- func (t *Table) SetRowLine(line bool)
- func (t *Table) SetRowSeparator(sep string)
Constants ¶
const ( CENTER_TOP_HEADER = "┳" CENTER_HEADER = "╋" CENTER = "╂" ROW = "─" ROW_HEADER = "━" ROW_FOOTER = "━" COLUMN = "┃" COLUMN_LEFT_SEPERATED = "┠" COLUMN_RIGHT_SEPERATED = "┨" COLUMN_HEADER_LEFT_SEPERATED = "┣" COLUMN_HEADER_RIGHT_SEPERATED = "┫" COLUMN_LEFT_TOP = "┏" COLUMN_RIGHT_TOP = "┓" COLUMN_LEFT_BOTTOM = "┗" COLUMN_CENTER_BOTTOM = "┻" COLUMN_RIGHT_BOTTOM = "┛" SPACE = " " NEWLINE = "\n" )
const ( ALIGN_DEFAULT = iota ALIGN_CENTER ALIGN_RIGHT ALIGN_LEFT )
const (
MAX_ROW_WIDTH = 30
)
Variables ¶
This section is empty.
Functions ¶
func ConditionString ¶
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 (*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) SetAutoMergeCells ¶
Set Auto Merge Cells This would enable / disable the merge of cells with identical values
func (*Table) SetAutoWrapText ¶
Turn automatic multiline text adjustment on/off. Default is on (true).
func (*Table) SetBorders ¶
func (*Table) SetCenterSeparator ¶
Set the center Separator
func (*Table) SetFooterAlignment ¶
Set Footer Alignment
func (*Table) SetHeaderAlignment ¶
Set Header Alignment
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