output

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ascending = iota
	Descending
)
View Source
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 AuditLogOptions struct {
	MinTime time.Time
	MaxTime time.Time
}

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 SortOptions struct {
	Order        SortOrder
	SortByColumn string
}

type SortOrder

type SortOrder int

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) Len

func (tf *TableFactory) Len() int

Len implements sort.Sorter interface

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL