ColumnConfig contains configurations that determine and modify the way the
contents of the column get rendered.
Align defines the horizontal alignment
AlignFooter defines the horizontal alignment of Footer rows
AlignHeader defines the horizontal alignment of Header rows
AutoMerge merges cells with similar values and prevents separators from
being drawn. Caveats:
* VAlign is applied on the individual cell and not on the merged cell
* Does not work in CSV/HTML/Markdown render modes
* Does not work well with horizontal auto-merge (RowConfig.AutoMerge)
Works best when:
* Style().Options.SeparateRows == true
* Style().Color.Row == Style().Color.RowAlternate (or not set)
Colors defines the colors to be used on the column
ColorsFooter defines the colors to be used on the column in Footer rows
ColorsHeader defines the colors to be used on the column in Header rows
Hidden when set to true will prevent the column from being rendered.
This is useful in cases like needing a column for sorting, but not for
display.
Name is the name of the Column as it appears in the first Header row.
If a Header is not provided, or the name is not found in the header, this
will not work.
Number is the Column # from left. When specified, it overrides the Name
property. If you know the exact Column number, use this instead of Name.
Transformer is a custom-function that changes the way the value gets
rendered to the console. Refer to text/transformer.go for ready-to-use
Transformer functions.
TransformerFooter is like Transformer but for Footer rows
TransformerHeader is like Transformer but for Header rows
VAlign defines the vertical alignment
VAlignFooter defines the vertical alignment in Footer rows
VAlignHeader defines the vertical alignment in Header rows
WidthMax defines the maximum character length of the column
WidthEnforcer enforces the WidthMax value on the column contents;
default: text.WrapText
WidthMin defines the minimum character length of the column
( T) getWidthMaxEnforcer() WidthEnforcer
func (*Table).SetColumnConfigs(configs []ColumnConfig)
func Writer.SetColumnConfigs(configs []ColumnConfig)
FormatOptions defines the text-formatting to perform on parts of the Table.
// footer row(s) text format
// header row(s) text format
// (data) row(s) text format
var FormatOptionsDefault
HTMLOptions defines the global options to control HTML rendering.
// CSS class to set on the overall <table> tag
// string to replace "" columns with (entire content being "")
// escape text into HTML-safe content?
// string to replace "\n" characters with
var DefaultHTMLOptions
Options defines the global options that determine how the Table is
rendered.
DrawBorder enables or disables drawing the border around the Table.
Example of a table where it is disabled:
# │ FIRST NAME │ LAST NAME │ SALARY │
─────┼────────────┼───────────┼────────┼─────────────────────────────
1 │ Arya │ Stark │ 3000 │
20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow!
300 │ Tyrion │ Lannister │ 5000 │
─────┼────────────┼───────────┼────────┼─────────────────────────────
│ │ TOTAL │ 10000 │
SeparateColumns enables or disable drawing border between columns.
Example of a table where it is disabled:
┌─────────────────────────────────────────────────────────────────┐
│ # FIRST NAME LAST NAME SALARY │
├─────────────────────────────────────────────────────────────────┤
│ 1 Arya Stark 3000 │
│ 20 Jon Snow 2000 You know nothing, Jon Snow! │
│ 300 Tyrion Lannister 5000 │
│ TOTAL 10000 │
└─────────────────────────────────────────────────────────────────┘
SeparateFooter enables or disable drawing border between the footer and
the rows. Example of a table where it is disabled:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
SeparateHeader enables or disable drawing border between the header and
the rows. Example of a table where it is disabled:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
SeparateRows enables or disables drawing separators between each row.
Example of a table where it is enabled:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
var OptionsDefault
var OptionsNoBorders
var OptionsNoBordersAndSeparators
RowConfig contains configurations that determine and modify the way the
contents of a row get rendered.
AutoMerge merges cells with similar values and prevents separators from
being drawn. Caveats:
* Align is overridden to text.AlignCenter on the merged cell
* Does not work in CSV/HTML/Markdown render modes
* Does not work well with vertical auto-merge (ColumnConfig.AutoMerge)
func (*Table).getRowConfig(hint renderHint) RowConfig
func (*Table).AppendFooter(row Row, config ...RowConfig)
func (*Table).AppendHeader(row Row, config ...RowConfig)
func (*Table).AppendRow(row Row, config ...RowConfig)
func (*Table).AppendRows(rows []Row, config ...RowConfig)
func Writer.AppendFooter(row Row, configs ...RowConfig)
func Writer.AppendHeader(row Row, configs ...RowConfig)
func Writer.AppendRow(row Row, configs ...RowConfig)
func Writer.AppendRows(rows []Row, configs ...RowConfig)
RowPainter is a custom function that takes a Row as input and returns the
text.Colors{} to use on the entire row
func (*Table).SetRowPainter(painter RowPainter)
func Writer.SetRowPainter(painter RowPainter)
SortBy defines What to sort (Column Name or Number), and How to sort (Mode).
Mode tells the Writer how to Sort. Asc/Dsc/etc.
Name is the name of the Column as it appears in the first Header row.
If a Header is not provided, or the name is not found in the header, this
will not work.
Number is the Column # from left. When specified, it overrides the Name
property. If you know the exact Column number, use this instead of Name.
func (*Table).parseSortBy(sortBy []SortBy) []SortBy
func (*Table).SortBy(sortBy []SortBy)
func Writer.SortBy(sortBy []SortBy)
func (*Table).parseSortBy(sortBy []SortBy) []SortBy
Table helps print a 2-dimensional array in a human readable pretty-table.
allowedRowLength is the max allowed length for a row (or line of output)
enable automatic indexing of the rows and columns like a spreadsheet?
autoIndexVIndexMaxLength denotes the length in chars for the last rownum
caption stores the text to be rendered just below the table; and doesn't
get used when rendered as a CSV
columnConfigMap stores the custom-configuration by column
number and is generated before rendering
columnConfigs stores the custom-configuration for 1 or more columns
columnIsNonNumeric stores if a column contains non-numbers in all rows
htmlCSSClass stores the HTML CSS Class to use on the <table> node
indexColumn stores the number of the column considered as the "index"
maxColumnLengths stores the length of the longest line in each column
maxRowLength stores the length of the longest row
numColumns stores the (max.) number of columns seen
numLinesRendered keeps track of the number of lines rendered and helps in
paginating long tables
outputMirror stores an io.Writer where the "Render" functions would write
pageSize stores the maximum lines to render before rendering the header
again (to denote a page break) - useful when you are dealing with really
long tables
rowPainter is a custom function that given a Row, returns the colors to
use on the entire row
rowSeparator is a dummy row that contains the separator columns (dashes
that make up the separator between header/body/footer
rows stores the rows that make up the body (in string form)
rowsColors stores the text.Colors over-rides for each row as defined by
rowPainter
rowsConfigs stores RowConfig for each row
rowsFooter stores the rows that make up the footer (in string form)
rowsFooterConfigs stores RowConfig for each footer row
rowsFooterRaw stores the rows that make up the footer
rowsHeader stores the rows that make up the header (in string form)
rowsHeaderConfigs stores RowConfig for each header row
rowsHeaderRaw stores the rows that make up the header
rowsRaw stores the rows that make up the body
separators is used to keep track of all rowIndices after which a
separator has to be rendered
sortBy stores a map of Column
style contains all the strings used to draw the table, and more
suppressEmptyColumns hides columns which have no content on all regular
rows
title contains the text to appear above the table
AppendFooter appends the row to the List of footers to render.
Only the first item in the "config" will be tagged against this row.
AppendHeader appends the row to the List of headers to render.
Only the first item in the "config" will be tagged against this row.
AppendRow appends the row to the List of rows to render.
Only the first item in the "config" will be tagged against this row.
AppendRows appends the rows to the List of rows to render.
Only the first item in the "config" will be tagged against all the rows.
AppendSeparator helps render a separator row after the current last row. You
could call this function over and over, but it will be a no-op unless you
call AppendRow or AppendRows in between. Likewise, if the last thing you
append is a separator, it will not be rendered in addition to the usual table
separator.
******************************************************************************
Please note the following caveats:
1. SetPageSize(): this may end up creating consecutive separator rows near
the end of a page or at the beginning of a page
2. SortBy(): since SortBy could inherently alter the ordering of rows, the
separators may not appear after the row it was originally intended to
follow
******************************************************************************
Length returns the number of rows to be rendered.
Render renders the Table in a human-readable "pretty" format. Example:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
RenderCSV renders the Table in CSV format. Example:
#,First Name,Last Name,Salary,
1,Arya,Stark,3000,
20,Jon,Snow,2000,"You know nothing\, Jon Snow!"
300,Tyrion,Lannister,5000,
,,Total,10000,
RenderHTML renders the Table in HTML format. Example:
<table class="go-pretty-table">
<thead>
<tr>
<th align="right">#</th>
<th>First Name</th>
<th>Last Name</th>
<th align="right">Salary</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td align="right">1</td>
<td>Arya</td>
<td>Stark</td>
<td align="right">3000</td>
<td> </td>
</tr>
<tr>
<td align="right">20</td>
<td>Jon</td>
<td>Snow</td>
<td align="right">2000</td>
<td>You know nothing, Jon Snow!</td>
</tr>
<tr>
<td align="right">300</td>
<td>Tyrion</td>
<td>Lannister</td>
<td align="right">5000</td>
<td> </td>
</tr>
</tbody>
<tfoot>
<tr>
<td align="right"> </td>
<td> </td>
<td>Total</td>
<td align="right">10000</td>
<td> </td>
</tr>
</tfoot>
</table>
RenderMarkdown renders the Table in Markdown format. Example:
| # | First Name | Last Name | Salary | |
| ---:| --- | --- | ---:| --- |
| 1 | Arya | Stark | 3000 | |
| 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! |
| 300 | Tyrion | Lannister | 5000 | |
| | | Total | 10000 | |
ResetFooters resets and clears all the Footer rows appended earlier.
ResetHeaders resets and clears all the Header rows appended earlier.
ResetRows resets and clears all the rows appended earlier.
SetAllowedRowLength sets the maximum allowed length or a row (or line of
output) when rendered as a table. Rows that are longer than this limit will
be "snipped" to the length. Length has to be a positive value to take effect.
SetAutoIndex adds a generated header with columns such as "A", "B", "C", etc.
and a leading column with the row number similar to what you'd see on any
spreadsheet application. NOTE: Appending a Header will void this
functionality.
SetCaption sets the text to be rendered just below the table. This will not
show up when the Table is rendered as a CSV.
SetColumnConfigs sets the configs for each Column.
SetHTMLCSSClass sets the the HTML CSS Class to use on the <table> node
when rendering the Table in HTML format.
Deprecated: in favor of Style().HTML.CSSClass
SetIndexColumn sets the given Column # as the column that has the row
"Number". Valid values range from 1 to N. Note that this is not 0-indexed.
SetOutputMirror sets an io.Writer for all the Render functions to "Write" to
in addition to returning a string.
SetPageSize sets the maximum number of lines to render before rendering the
header rows again. This can be useful when dealing with tables containing a
long list of rows that can span pages. Please note that the pagination logic
will not consider Header/Footer lines for paging.
SetRowPainter sets the RowPainter function which determines the colors to use
on a row. Before rendering, this function is invoked on all rows and the
color of each row is determined. This color takes precedence over other ways
to set color (ColumnConfig.Color*, SetColor*()).
SetStyle overrides the DefaultStyle with the provided one.
SetTitle sets the title text to be rendered above the table.
SortBy sets the rules for sorting the Rows in the order specified. i.e., the
first SortBy instruction takes precedence over the second and so on. Any
duplicate instructions on the same column will be discarded while sorting.
Style returns the current style.
SuppressEmptyColumns hides columns when the column is empty in ALL the
regular rows.
(*T) analyzeAndStringify(row Row, hint renderHint) rowStr(*T) csvFixCommas(str string) string(*T) csvFixDoubleQuotes(str string) string(*T) csvRenderRow(out *strings.Builder, row rowStr, hint renderHint)(*T) csvRenderRows(out *strings.Builder, rows []rowStr, hint renderHint)(*T) getAlign(colIdx int, hint renderHint) text.Align(*T) getAutoIndexColumnIDs() rowStr(*T) getBorderColors(hint renderHint) text.Colors(*T) getColumnColors(colIdx int, hint renderHint) text.Colors(*T) getColumnSeparator(row rowStr, colIdx int, hint renderHint) string(*T) getColumnSeparatorNonBorder(mergeCellsAbove bool, mergeCellsBelow bool, colIdx int, hint renderHint) string(*T) getColumnSeparatorNonBorderAutoIndex(mergeNextCol bool, hint renderHint) string(*T) getColumnSeparatorNonBorderNonAutoIndex(mergeCellsAbove bool, mergeCellsBelow bool, mergeCurrCol bool, mergeNextCol bool) string(*T) getColumnTransformer(colIdx int, hint renderHint) text.Transformer(*T) getColumnWidthMax(colIdx int) int(*T) getColumnWidthMin(colIdx int) int(*T) getFormat(hint renderHint) text.Format(*T) getRow(rowIdx int, hint renderHint) rowStr(*T) getRowConfig(hint renderHint) RowConfig(*T) getSeparatorColors(hint renderHint) text.Colors
getSortedRowIndices sorts and returns the row indices in Sorted order as
directed by Table.sortBy which can be set using Table.SortBy(...)
(*T) getVAlign(colIdx int, hint renderHint) text.VAlign(*T) htmlRenderCaption(out *strings.Builder)(*T) htmlRenderColumnAttributes(out *strings.Builder, row rowStr, colIdx int, hint renderHint)(*T) htmlRenderColumnAutoIndex(out *strings.Builder, hint renderHint)(*T) htmlRenderRow(out *strings.Builder, row rowStr, hint renderHint)(*T) htmlRenderRows(out *strings.Builder, rows []rowStr, hint renderHint)(*T) htmlRenderRowsFooter(out *strings.Builder)(*T) htmlRenderRowsHeader(out *strings.Builder)(*T) htmlRenderTitle(out *strings.Builder)(*T) initForRender()(*T) initForRenderColumnConfigs()(*T) initForRenderColumnLengths()(*T) initForRenderHideColumns()(*T) initForRenderRowSeparator()(*T) initForRenderRows()(*T) initForRenderRowsStringify(rows []Row, hint renderHint) []rowStr(*T) initForRenderSortRows()(*T) initForRenderSuppressColumns()(*T) isIndexColumn(colIdx int, hint renderHint) bool(*T) markdownRenderCaption(out *strings.Builder)(*T) markdownRenderRow(out *strings.Builder, row rowStr, hint renderHint)(*T) markdownRenderRows(out *strings.Builder, rows []rowStr, hint renderHint)(*T) markdownRenderRowsFooter(out *strings.Builder)(*T) markdownRenderRowsHeader(out *strings.Builder)(*T) markdownRenderTitle(out *strings.Builder)(*T) parseSortBy(sortBy []SortBy) []SortBy(*T) render(out *strings.Builder) string(*T) renderColumn(out *strings.Builder, row rowStr, colIdx int, maxColumnLength int, hint renderHint) int(*T) renderColumnAutoIndex(out *strings.Builder, hint renderHint)(*T) renderColumnColorized(out *strings.Builder, colIdx int, colStr string, hint renderHint)(*T) renderColumnSeparator(out *strings.Builder, row rowStr, colIdx int, hint renderHint)(*T) renderLine(out *strings.Builder, row rowStr, hint renderHint)(*T) renderMarginLeft(out *strings.Builder, hint renderHint)(*T) renderMarginRight(out *strings.Builder, hint renderHint)(*T) renderRow(out *strings.Builder, row rowStr, hint renderHint)(*T) renderRowSeparator(out *strings.Builder, hint renderHint)(*T) renderRows(out *strings.Builder, rows []rowStr, hint renderHint)(*T) renderRowsBorderBottom(out *strings.Builder)(*T) renderRowsBorderTop(out *strings.Builder)(*T) renderRowsFooter(out *strings.Builder)(*T) renderRowsHeader(out *strings.Builder)(*T) renderTitle(out *strings.Builder)(*T) reset()(*T) shouldMergeCellsHorizontallyAbove(row rowStr, colIdx int, hint renderHint) bool(*T) shouldMergeCellsHorizontallyBelow(row rowStr, colIdx int, hint renderHint) bool(*T) shouldMergeCellsVertically(colIdx int, hint renderHint) bool
*T : Writer
Package-Level Functions (total 4, in which 2 are exported)
AutoIndexColumnID returns a unique Column ID/Name for the given Column Number.
The functionality is similar to what you get in an Excel spreadsheet w.r.t.
the Column ID/Name.
NewWriter initializes and returns a Writer.
isNumber returns true if the argument is a numeric type; false otherwise.
widthEnforcerNone returns the input string as is without any modifications.
Package-Level Variables (total 61, in which 59 are exported)
ColorOptionsBlackOnBlueWhite renders Black text on Blue/White background.
ColorOptionsBlackOnCyanWhite renders Black text on Cyan/White background.
ColorOptionsBlackOnGreenWhite renders Black text on Green/White
background.
ColorOptionsBlackOnMagentaWhite renders Black text on Magenta/White
background.
ColorOptionsBlackOnRedWhite renders Black text on Red/White background.
ColorOptionsBlackOnYellowWhite renders Black text on Yellow/White
background.
ColorOptionsBlueWhiteOnBlack renders Blue/White text on Black background.
ColorOptionsBright renders dark text on bright background.
ColorOptionsCyanWhiteOnBlack renders Cyan/White text on Black background.
ColorOptionsDark renders bright text on dark background.
ColorOptionsDefault defines sensible ANSI color options - basically NONE.
ColorOptionsGreenWhiteOnBlack renders Green/White text on Black
background.
ColorOptionsMagentaWhiteOnBlack renders Magenta/White text on Black
background.
ColorOptionsRedWhiteOnBlack renders Red/White text on Black background.
ColorOptionsYellowWhiteOnBlack renders Yellow/White text on Black
background.
DefaultHTMLOptions defines sensible HTML rendering defaults.
OptionsNoBorders sets up a table without any borders.
OptionsNoBordersAndSeparators sets up a table without any borders or
separators.
StyleBold renders a Table like below:
┏━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ # ┃ FIRST NAME ┃ LAST NAME ┃ SALARY ┃ ┃
┣━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 1 ┃ Arya ┃ Stark ┃ 3000 ┃ ┃
┃ 20 ┃ Jon ┃ Snow ┃ 2000 ┃ You know nothing, Jon Snow! ┃
┃ 300 ┃ Tyrion ┃ Lannister ┃ 5000 ┃ ┃
┣━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ ┃ ┃ TOTAL ┃ 10000 ┃ ┃
┗━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
StyleBoxBold defines a Boxed-Table like below:
┏━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ # ┃ FIRST NAME ┃ LAST NAME ┃ SALARY ┃ ┃
┣━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 1 ┃ Arya ┃ Stark ┃ 3000 ┃ ┃
┃ 20 ┃ Jon ┃ Snow ┃ 2000 ┃ You know nothing, Jon Snow! ┃
┃ 300 ┃ Tyrion ┃ Lannister ┃ 5000 ┃ ┃
┣━━━━━╋━━━━━━━━━━━━╋━━━━━━━━━━━╋━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ ┃ ┃ TOTAL ┃ 10000 ┃ ┃
┗━━━━━┻━━━━━━━━━━━━┻━━━━━━━━━━━┻━━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
StyleBoxDefault defines a Boxed-Table like below:
+-----+------------+-----------+--------+-----------------------------+
| # | FIRST NAME | LAST NAME | SALARY | |
+-----+------------+-----------+--------+-----------------------------+
| 1 | Arya | Stark | 3000 | |
| 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! |
| 300 | Tyrion | Lannister | 5000 | |
+-----+------------+-----------+--------+-----------------------------+
| | | TOTAL | 10000 | |
+-----+------------+-----------+--------+-----------------------------+
StyleBoxDouble defines a Boxed-Table like below:
╔═════╦════════════╦═══════════╦════════╦═════════════════════════════╗
║ # ║ FIRST NAME ║ LAST NAME ║ SALARY ║ ║
╠═════╬════════════╬═══════════╬════════╬═════════════════════════════╣
║ 1 ║ Arya ║ Stark ║ 3000 ║ ║
║ 20 ║ Jon ║ Snow ║ 2000 ║ You know nothing, Jon Snow! ║
║ 300 ║ Tyrion ║ Lannister ║ 5000 ║ ║
╠═════╬════════════╬═══════════╬════════╬═════════════════════════════╣
║ ║ ║ TOTAL ║ 10000 ║ ║
╚═════╩════════════╩═══════════╩════════╩═════════════════════════════╝
StyleBoxLight defines a Boxed-Table like below:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
StyleBoxRounded defines a Boxed-Table like below:
╭─────┬────────────┬───────────┬────────┬─────────────────────────────╮
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
╰─────┴────────────┴───────────┴────────┴─────────────────────────────╯
StyleColoredBlackOnBlueWhite renders a Table without any borders or
separators, and with Black text on Blue background for Header/Footer and
White background for other rows.
StyleColoredBlackOnCyanWhite renders a Table without any borders or
separators, and with Black text on Cyan background for Header/Footer and
White background for other rows.
StyleColoredBlackOnGreenWhite renders a Table without any borders or
separators, and with Black text on Green background for Header/Footer and
White background for other rows.
StyleColoredBlackOnMagentaWhite renders a Table without any borders or
separators, and with Black text on Magenta background for Header/Footer and
White background for other rows.
StyleColoredBlackOnRedWhite renders a Table without any borders or
separators, and with Black text on Red background for Header/Footer and
White background for other rows.
StyleColoredBlackOnYellowWhite renders a Table without any borders or
separators, and with Black text on Yellow background for Header/Footer and
White background for other rows.
StyleColoredBlueWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Blue text and other rows with
White text, all on Black background.
StyleColoredBright renders a Table without any borders or separators,
and with Black text on Cyan background for Header/Footer and
White background for other rows.
StyleColoredCyanWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Cyan text and other rows with
White text, all on Black background.
StyleColoredDark renders a Table without any borders or separators, and
with Header/Footer in Cyan text and other rows with White text, all on
Black background.
StyleColoredGreenWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Green text and other rows with
White text, all on Black background.
StyleColoredMagentaWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Magenta text and other rows with
White text, all on Black background.
StyleColoredRedWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Red text and other rows with
White text, all on Black background.
StyleColoredYellowWhiteOnBlack renders a Table without any borders or
separators, and with Header/Footer in Yellow text and other rows with
White text, all on Black background.
StyleDefault renders a Table like below:
+-----+------------+-----------+--------+-----------------------------+
| # | FIRST NAME | LAST NAME | SALARY | |
+-----+------------+-----------+--------+-----------------------------+
| 1 | Arya | Stark | 3000 | |
| 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! |
| 300 | Tyrion | Lannister | 5000 | |
+-----+------------+-----------+--------+-----------------------------+
| | | TOTAL | 10000 | |
+-----+------------+-----------+--------+-----------------------------+
StyleDouble renders a Table like below:
╔═════╦════════════╦═══════════╦════════╦═════════════════════════════╗
║ # ║ FIRST NAME ║ LAST NAME ║ SALARY ║ ║
╠═════╬════════════╬═══════════╬════════╬═════════════════════════════╣
║ 1 ║ Arya ║ Stark ║ 3000 ║ ║
║ 20 ║ Jon ║ Snow ║ 2000 ║ You know nothing, Jon Snow! ║
║ 300 ║ Tyrion ║ Lannister ║ 5000 ║ ║
╠═════╬════════════╬═══════════╬════════╬═════════════════════════════╣
║ ║ ║ TOTAL ║ 10000 ║ ║
╚═════╩════════════╩═══════════╩════════╩═════════════════════════════╝
StyleLight renders a Table like below:
┌─────┬────────────┬───────────┬────────┬─────────────────────────────┐
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
└─────┴────────────┴───────────┴────────┴─────────────────────────────┘
StyleRounded renders a Table like below:
╭─────┬────────────┬───────────┬────────┬─────────────────────────────╮
│ # │ FIRST NAME │ LAST NAME │ SALARY │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ 1 │ Arya │ Stark │ 3000 │ │
│ 20 │ Jon │ Snow │ 2000 │ You know nothing, Jon Snow! │
│ 300 │ Tyrion │ Lannister │ 5000 │ │
├─────┼────────────┼───────────┼────────┼─────────────────────────────┤
│ │ │ TOTAL │ 10000 │ │
╰─────┴────────────┴───────────┴────────┴─────────────────────────────╯
TitleOptionsBlackOnBlue renders Black text on Blue background.
TitleOptionsBlackOnCyan renders Black Bold text on Cyan background.
TitleOptionsBlackOnGreen renders Black Bold text onGreen background.
TitleOptionsBlackOnMagenta renders Black Bold text on Magenta background.
TitleOptionsBlackOnRed renders Black Bold text on Red background.
TitleOptionsBlackOnYellow renders Black Bold text on Yellow background.
TitleOptionsBlueOnBlack renders Blue Bold text on Black background.
TitleOptionsBright renders Bright Bold text on Dark background.
TitleOptionsCyanOnBlack renders Cyan Bold text on Black background.
TitleOptionsDark renders Dark Bold text on Bright background.
TitleOptionsDefault defines sensible title options - basically NONE.
TitleOptionsGreenOnBlack renders Green Bold text on Black background.
TitleOptionsMagentaOnBlack renders Magenta Bold text on Black background.
TitleOptionsRedOnBlack renders Red Bold text on Black background.
TitleOptionsYellowOnBlack renders Yellow Bold text on Black background.
Package-Level Constants (total 5, all are exported)
Asc sorts the column in Ascending order alphabetically.
AscNumeric sorts the column in Ascending order numerically.
DefaultHTMLCSSClass stores the css-class to use when none-provided via
SetHTMLCSSClass(cssClass string).
Dsc sorts the column in Descending order alphabetically.
DscNumeric sorts the column in Descending order numerically.
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.