Documentation
¶
Index ¶
- Constants
- Variables
- type Align
- type Cell
- type Column
- type ColumnOverFlowAction
- type ColumnStyle
- type ColumnWidthControl
- type DataCell
- type Output
- type Row
- type StandardColumn
- type Table
- func (a *Table) AppendColumn(cs ...*Column) (*Table, error)
- func (a *Table) AppendRow(c ...any) error
- func (a *Table) AppendRowM(m map[string]any) error
- func (a *Table) AppendTrees(sty TreePathStyle, ns ...TreeNodeReader) error
- func (a *Table) Cell(col, row int) *Cell
- func (a *Table) GetColumn(name string) (*Column, error)
- func (a *Table) Render(o Output) (string, error)
- func (a *Table) ResetData()
- type TableLayout
- type TableStats
- type TextStyle
- type TreeNodeReader
- type TreePathCell
- type TreePathColumn
- type TreePathStyle
- type TreeStatistics
Constants ¶
View Source
const ( MinColumnWidth int = 2 AdjustableColumnMinWidth int = 6 UnfinishedCellTailer string = " ~" )
Variables ¶
View Source
var ( ErrColumnAlreadyExist = errors.New("column already exist") ErrColumnNotExist = errors.New("column does not exist") ErrEnforcingTableWidth = errors.New("enforcing table width failed") ErrFieldIsMissing = errors.New("field is missing") ErrInsufficientColumnHeight = errors.New("insufficient column height") ErrInsufficientColumnWidth = errors.New("insufficient column width") ErrInvalidCellHeight = errors.New("invalid cell height") ErrInvalidCellWidth = errors.New("invalid cell width") ErrNoAdjustableColumn = errors.New("no adjustable column") ErrRenderTableFailed = errors.New("render table failed") ErrTableNotEmpty = errors.New("table is not empty") )
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
func NewStandardColumn ¶
func NewTreePathColumn ¶
func NewTreePathColumn(sty TreePathStyle) *Column
func (*Column) BodyStyle ¶
func (a *Column) BodyStyle(sty *ColumnStyle) *Column
func (*Column) HeaderStyle ¶
func (a *Column) HeaderStyle(sty *ColumnStyle) *Column
type ColumnOverFlowAction ¶
type ColumnOverFlowAction int
const ( Wordwrap ColumnOverFlowAction = iota Truncate Exception )
type ColumnStyle ¶
type ColumnStyle struct {
// contains filtered or unexported fields
}
func DefauleBodyStyle ¶
func DefauleBodyStyle() *ColumnStyle
func DefauleHeaderStyle ¶
func DefauleHeaderStyle() *ColumnStyle
func DefauleTreeStyle ¶
func DefauleTreeStyle() *ColumnStyle
func (*ColumnStyle) Align ¶
func (a *ColumnStyle) Align(al Align) *ColumnStyle
func (*ColumnStyle) EscapeLineFeed ¶
func (a *ColumnStyle) EscapeLineFeed(b bool) *ColumnStyle
func (*ColumnStyle) OverFlowAction ¶
func (a *ColumnStyle) OverFlowAction(ofa ColumnOverFlowAction) *ColumnStyle
func (*ColumnStyle) Text ¶
func (a *ColumnStyle) Text(st ...TextStyle) *ColumnStyle
type ColumnWidthControl ¶
type ColumnWidthControl int
const ( AutoExpand ColumnWidthControl = iota NoAutoExpand )
type StandardColumn ¶
type StandardColumn struct { }
type Table ¶
type Table struct { Layout TableLayout // contains filtered or unexported fields }
func NewTable ¶
func NewTable(l *TableLayout) *Table
func (*Table) AppendRowM ¶
AppendRowM add construct a table row from a Row and append to the table
func (*Table) AppendTrees ¶
func (a *Table) AppendTrees(sty TreePathStyle, ns ...TreeNodeReader) error
type TableLayout ¶
type TableLayout struct { HeaderTopLeft rune HeaderTopRight rune HeaderTopSeparator rune HeaderTopHorizontal rune HeaderLeft rune HeaderRight rune HeaderSeparator rune HeaderBottomLeft rune HeaderBottomRight rune HeaderBottomSeparator rune HeaderBottomHorizontal rune BodyTopLeft rune BodyTopRight rune BodyTopSeparator rune BodyTopHorizontal rune BodyBottomLeft rune BodyBottomRight rune BodyBottomSeparator rune BodyBottomHorizontal rune RowLeft rune RowRight rune RowSeparator rune RowHorizontal rune ColumnSeparator rune ColumnPaddingLeft string ColumnPaddingRight string CellPadding string ShowHeader bool ShowHeaderTopBorder bool ShowHeaderBottemBorder bool ShowBodyTopBorder bool ShowBodyBottomBorder bool ShowSideBorder bool ShowColumnSeparator bool ShowRowSeparator bool Width int }
func DefaultTableLayout ¶
func DefaultTableLayout() *TableLayout
func LightTableLayout ¶
func LightTableLayout() *TableLayout
func (*TableLayout) HideHeader ¶
func (a *TableLayout) HideHeader() *TableLayout
func (*TableLayout) HideOutterBorder ¶
func (a *TableLayout) HideOutterBorder() *TableLayout
func (*TableLayout) SplitHeaderAndBody ¶
func (a *TableLayout) SplitHeaderAndBody() *TableLayout
type TableStats ¶
type TreeNodeReader ¶
type TreeNodeReader interface { Children() []TreeNodeReader Fields() map[string]any }
type TreePathCell ¶
type TreePathCell struct {
// contains filtered or unexported fields
}
type TreePathColumn ¶
type TreePathColumn struct {
// contains filtered or unexported fields
}
type TreePathStyle ¶
type TreePathStyle struct { Name string Root string Middle string Terminal string PadLine string PadBlank string Children string PrefixLeveled string PrefixBlank string // contains filtered or unexported fields }
func DefaultTreePathStyle ¶
func DefaultTreePathStyle() *TreePathStyle
func LightTreePathStyle ¶
func LightTreePathStyle() *TreePathStyle
func (*TreePathStyle) Body ¶
func (a *TreePathStyle) Body(ss ...TextStyle) *TreePathStyle
func (*TreePathStyle) Header ¶
func (a *TreePathStyle) Header(ss ...TextStyle) *TreePathStyle
func (TreePathStyle) ReplacePathAsExtention ¶
func (a TreePathStyle) ReplacePathAsExtention(s string) string
type TreeStatistics ¶
type TreeStatistics struct {
MaxDepth int
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.