Documentation
¶
Index ¶
- func ClipLeft(s string, maxLength int) string
- func ClipRight(s string, maxLength int) string
- func MaxInt(a int, b int) int
- func MinInt(a int, b int) int
- func PrettyPrintMap[K comparable, V any](m map[K]V) string
- type SortBy
- type SortMode
- type StrOrder
- type Table
- func (t *Table) NumRows() int
- func (t Table) Sort() *Table
- func (t Table) SortBy(sortBy []SortBy) *Table
- func (t Table) String() string
- func (t *Table) TotalsByCol(col int) map[string]int
- func (t Table) WithFooter(item string) *Table
- func (t Table) WithHeader(items ...string) *Table
- func (t Table) WithRow(row ...string) *Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrettyPrintMap ¶ added in v0.0.10
func PrettyPrintMap[K comparable, V any](m map[K]V) string
Single line map string format from "map[foo:90 bar:30]" to "(foo: 90, bar: 30)"
Types ¶
type SortMode ¶ added in v0.0.10
type SortMode int
SortMode defines How to sort.
const ( // Asc sorts the column in Ascending order alphabetically. Asc SortMode = iota // AscNumeric sorts the column in Ascending order numerically. AscNumeric // Custom sorts the column in Ascending order by custom string index order AscCustom // Dsc sorts the column in Descending order alphabetically. Dsc // DscNumeric sorts the column in Descending order numerically. DscNumeric // Custom sorts the column in Descending order by custom string index order DscCustom )
type StrOrder ¶ added in v0.0.10
type StrOrder []string
StrOrder defines a custom index to sort by. Ex: StrOrder{"Hot", "Warm", "Cold"}
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (Table) SortBy ¶ added in v0.0.10
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.
func (Table) WithFooter ¶ added in v0.0.10
func (Table) WithHeader ¶
Click to show internal directories.
Click to hide internal directories.