Documentation ¶
Overview ¶
package table prettifies tab/line text tables to aligned/formatted/sorted/rearranged and justified text tables.
Index ¶
- Constants
- Variables
- func Centred(c string, w int)
- func Fprint(w io.Writer, tabulated string, cellPrinters ...func(string, int))
- func Fprintf(w io.Writer, s string, tabulated string, cellPrinters ...func(string, int))
- func LeftJustified(c string, w int)
- func MinWidth(form func(string, int), min uint) func(string, int)
- func MoveToLeftEdge(column uint) func(int) int
- func NumbersBoolJustified(c string, w int)
- func NumbersRightJustified(c string, w int)
- func Print(tabulated string, cellPrinters ...func(string, int))
- func Printf(s string, tabulated string, cellPrinters ...func(string, int))
- func RightJustified(c string, w int)
Constants ¶
const ( ASCIIStyle string = "+-++| ||" ASCIIBoxStyle string = "+-+++-++| ||+-++" MarkdownStyle string = "|-||| ||" BoxStyle string = "┌─┬┐├─┼┤│ ││└─┴┘" DoubleBoxStyle string = "╔═╦╗╠═╬╣║ ║║╚═╩╝" ThickHeaderDivideBoxStyle string = "┌─┬┐┝━┿┥│ ││└─┴┘" DoubleBorderBoxStyle string = "╔═╤╗╟─┼╢║ │║╚═╧╝" DoubleVerticalBoxStyle string = "╓─╥╖╟─╫╢║ ║║╙─╨╜" DoubleHorizontalBoxStyle string = "╒═╤╕╞═╪╡│ ││╘═╧╛" DoubleSingleHorizontalBoxStyle string = "╔═╤╗╠═╪╣║ │║╚═╧╝" DoubleTopBottomBoxStyle string = "╒═╤╕├─┼┤│ ││╘═╧╛" DoubleSidesBoxStyle string = "╓─┬╖╟─┼╢║ │║╙─┴╜" DoubleTopBoxStyle string = "╒═╤╕├─┼┤│ ││└─┴┘" DoubleDivideBoxStyle string = "┌─┬┐╞═╪╡│ ││└─┴┘" DoubleBottomBoxStyle string = "┌─┬┐├─┼┤│ ││╘═╧╛" DoubleRightBoxStyle string = "┌─┬╖├─┼┤│ ││└─┴╜" DoubleLeftBoxStyle string = "╓─┬┐╟─┼┤║ ││╙─┴┘" DoubleInsideBoxStyle string = "┌─╥┐╞═╬╡│ ║│└─╨┘" DoubleInsideVerticalBoxStyle string = "┌─╥┐├─╫┤│ ║│└─╨┘" DoubleInsideHorizontalBoxStyle string = "┌─┬┐╞═╪╡│ ││└─┴┘" RoundedBoxStyle string = "╭─┬╮├─┼┤│ ││╰─┴╯" RoundedDoubleInsideBoxStyle string = "╭─╥╮╞═╬╡│ ║│╰─╨╯" RoundedDoubleInsideHorizontalBoxStyle string = "╭─┬╮╞═╪╡│ ││╰─┴╯" RoundedDoubleInsideVerticalBoxStyle string = "╭─╥╮├─╫┤│ ║│╰─╨╯" )
built-in Styles
Variables ¶
var ( Writer io.Writer HeaderRows = 1 Style = MarkdownStyle ColumnMapper func(int) int // rearrange columns SortColumn int NumericNotAlphaSort bool DefaultCellPrinter = Centred DividerEvery int FormfeedWithDivider bool )
global options
Functions ¶
func MoveToLeftEdge ¶
returns a column mapper func, that puts a particular column first, (columns start from 1), otherwise preserves order. 返回一个列映射器函数,它将特定列放在第一位(列从 1 开始),否则保留顺序。
func NumbersBoolJustified ¶
centre print if a boolean, right justify if a number, default otherwise. 如果是布尔值则居中打印,如果是数字则右对齐,否则默认。
func NumbersRightJustified ¶
right justify if a number 如果一个数字右对齐
func Print ¶
Write 'tabulated' string as text table, rows coming from lines, columns separated by the tab character. Mono-spaced font required for alignment. cellPrinters - applied to columns: * missing - use default * len=1 - use for all cells * len=n - use n'th for n'th column, use default if column count>n Not thread safe, uses globals for options (see variables), however can be used multiple, fixed count, times by using multiple imports and different aliases. Bytes supporting. 将“制表”字符串写为文本表,行来自行,列由制表符分隔。对齐所需的等距字体。 cellPrinters - 应用于列:缺失 - 使用默认值 len=1 - 用于所有单元格 len=n - 对第 n 列使用 n'th,如果列数>n 则使用默认值 不是线程安全的,使用全局变量作为选项(参见变量),但是可以通过使用多个导入和不同的别名来使用多个固定计数的时间。 Bytes 支持。
Types ¶
This section is empty.