Documentation ¶
Index ¶
- func IsFieldNotFoundError(err error) bool
- func IsMultipleFieldsMatchingError(err error) bool
- func RemoveColors(s string) string
- func SortMapSliceUsingColumnData(mapSlice []map[string]interface{}, byCol Column, ...)
- type Column
- type Table
- func (t *Table) GetColumnByName(n string) (int, Column, error)
- func (t *Table) GetColumnNameFromInitials(i string) (string, error)
- func (t *Table) SetColumns(c []Column)
- func (t *Table) SetRows(r [][]string)
- func (t *Table) SortByColumnName(n string, direction string) error
- func (t *Table) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFieldNotFoundError ¶
IsFieldNotFoundError asserts fieldNotFoundError.
func IsMultipleFieldsMatchingError ¶
IsMultipleFieldsMatchingError asserts multipleFieldsMatchingError.
func RemoveColors ¶
func SortMapSliceUsingColumnData ¶
func SortMapSliceUsingColumnData(mapSlice []map[string]interface{}, byCol Column, fieldMapping map[string]string)
SortMapSliceUsingColumnData manages table-like sorting on non-table data types. This is especially useful if you want to encode in JSON the data in a table
Types ¶
type Column ¶
type Column struct { sortable.Sortable // Name represents the column name that will be used for sorting, // and as a default table header. Name string // DisplayName represents the table header visible in the printed table. DisplayName string Hidden bool }
Column represents the data structure of a table column.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a data structure that can hold and display the contents of a table.
func (*Table) GetColumnByName ¶
GetColumnByName fetches the index and data structure of a column, by knowing its name.
func (*Table) GetColumnNameFromInitials ¶
GetColumnNameFromInitials matches a given input with a name of an existent column, without caring about casing, or if the given input is the complete name of the column.
func (*Table) SetColumns ¶
SetColumns sets the table's columns.
func (*Table) SortByColumnName ¶
SortByColumnName sorts the table by a column name, in the given direction.