Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatEntity ¶
FormatEntity returns a formatted string from the supplied entity title and table of attributes.
func GetEntityPadding ¶
GetEntityPadding will determine the minimum width necessary to display the entity attributes.
Types ¶
type EntityFormatter ¶
type EntityFormatter struct { Separator string // contains filtered or unexported fields }
EntityFormatter can be used for neatly displaying attributes of a single entity.
func NewEntityFormatter ¶
func NewEntityFormatter(title string, padWidth int) *EntityFormatter
NewEntityFormatter returns an initialized EntityFormatter.
func (*EntityFormatter) Format ¶
func (f *EntityFormatter) Format(table []TableRow) string
Format generates an output string for the supplied table rows. It includes a single subject header, and each row is printed as an attribute/value pair.
func (*EntityFormatter) Init ¶
func (f *EntityFormatter) Init(padWidth int)
Init instantiates internal variables.
type TableFormatter ¶
type TableFormatter struct {
// contains filtered or unexported fields
}
TableFormatter is a structure that formats string output for a table with labeled columns.
func NewTableFormatter ¶
func NewTableFormatter(columnTitles ...string) *TableFormatter
NewTableFormatter creates and instantiates a new TableFormatter.
func (*TableFormatter) Format ¶
func (t *TableFormatter) Format(table []TableRow) string
Format generates an output string for the set of table rows provided. It includes a header with column titles, and fills only the requested columns in order.
func (*TableFormatter) SetColumnTitles ¶
func (t *TableFormatter) SetColumnTitles(c ...string)
SetColumnTitles sets the ordered column titles for the table.