Documentation ¶
Index ¶
- Constants
- func DefaultAgeColumnFormatter() func(i interface{}) string
- type AuditLogOptions
- type ExportFormat
- type ExportOptions
- type OutputOptions
- type SortOptions
- type SortOrder
- type TableFactory
- func (tf *TableFactory) Len() int
- func (tf *TableFactory) Less(i, j int) bool
- func (tf *TableFactory) SetColumnFormatter(column string, columnFormatter func(interface{}) string) *TableFactory
- func (tf *TableFactory) SetData(data [][]interface{}) *TableFactory
- func (tf *TableFactory) SetExportFile(exportFile string) *TableFactory
- func (tf *TableFactory) SetExportFormat(exportFormat ExportFormat) *TableFactory
- func (tf *TableFactory) SetHeader(header []string) *TableFactory
- func (tf *TableFactory) SetSortColumn(column string) *TableFactory
- func (tf *TableFactory) SetSortIndex(sortIndex uint) *TableFactory
- func (tf *TableFactory) SetSortOrder(sortOrder SortOrder) *TableFactory
- func (tf *TableFactory) Swap(i, j int)
- func (tf *TableFactory) ToTable() (*tablewriter.Table, error)
Constants ¶
const ( Ascending = iota Descending )
const (
CSV = iota
)
Variables ¶
This section is empty.
Functions ¶
func DefaultAgeColumnFormatter ¶
func DefaultAgeColumnFormatter() func(i interface{}) string
Types ¶
type AuditLogOptions ¶ added in v0.3.8
type ExportFormat ¶ added in v0.1.6
type ExportFormat int
type ExportOptions ¶ added in v0.1.6
type ExportOptions struct { Format ExportFormat File string }
type OutputOptions ¶
type OutputOptions struct { SortOptions SortOptions ExportOptions ExportOptions ShowDeleted bool Wide bool }
type SortOptions ¶
type TableFactory ¶
type TableFactory struct {
// contains filtered or unexported fields
}
TableFactory to print a table with sorting
func NewTableFactory ¶
func NewTableFactory() *TableFactory
NewTableFactory creates a new TableFactory to render a sorted table
func (*TableFactory) Less ¶
func (tf *TableFactory) Less(i, j int) bool
Less implements sort.Sorter interface
func (*TableFactory) SetColumnFormatter ¶
func (tf *TableFactory) SetColumnFormatter(column string, columnFormatter func(interface{}) string) *TableFactory
SetColumnFormatter sets a new formatter for a specific column to render data
func (*TableFactory) SetData ¶
func (tf *TableFactory) SetData(data [][]interface{}) *TableFactory
SetData sets the data rows of the table
func (*TableFactory) SetExportFile ¶ added in v0.1.6
func (tf *TableFactory) SetExportFile(exportFile string) *TableFactory
SetExportFile sets the file to which the data will be written
func (*TableFactory) SetExportFormat ¶ added in v0.1.6
func (tf *TableFactory) SetExportFormat(exportFormat ExportFormat) *TableFactory
SetExportFormat sets the file format in which the data will be written. CSV is set by default
func (*TableFactory) SetHeader ¶
func (tf *TableFactory) SetHeader(header []string) *TableFactory
SetHeader sets the header row of the table
func (*TableFactory) SetSortColumn ¶
func (tf *TableFactory) SetSortColumn(column string) *TableFactory
SetSortColumn sets the index of the column after which the data should be sorted when rendering the table by column name
func (*TableFactory) SetSortIndex ¶
func (tf *TableFactory) SetSortIndex(sortIndex uint) *TableFactory
SetSortIndex sets the index of the column after which the data should be sorted when rendering the table
func (*TableFactory) SetSortOrder ¶
func (tf *TableFactory) SetSortOrder(sortOrder SortOrder) *TableFactory
SetSortOrder sets the SortOrder when rendering the table
func (*TableFactory) Swap ¶
func (tf *TableFactory) Swap(i, j int)
Swap implements sort.Sorter interface
func (*TableFactory) ToTable ¶
func (tf *TableFactory) ToTable() (*tablewriter.Table, error)
ToTable creates a tablewriter.Table instance with sorted data and default rendering settings