table

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(t Table) (string, error)

func MustFormat

func MustFormat(t Table) string

Return the error message as a string

Types

type Header struct {
	Title    string
	MaxWidth int // Max width of the text (not including spacing). Items that are longer will be truncated to less than MaxWidth to fit the ellipses. If 0 is provided, it defaults to no max.
	MinWidth int // Min width of the text (not including spacing)
	Hidden   bool
}

type KeyValuePairOpts added in v0.12.0

type KeyValuePairOpts struct {
	Delimiter *string // default: ":"
	NumSpaces *int    // default: 1
}

type KeyValuePairs added in v0.12.0

type KeyValuePairs struct {
	// contains filtered or unexported fields
}

func (*KeyValuePairs) Add added in v0.12.0

func (kvs *KeyValuePairs) Add(key interface{}, value interface{})

func (*KeyValuePairs) AddAll added in v0.12.0

func (kvs *KeyValuePairs) AddAll(kvs2 KeyValuePairs)

func (KeyValuePairs) Print added in v0.12.0

func (kvs KeyValuePairs) Print(options ...*KeyValuePairOpts)

func (KeyValuePairs) String added in v0.12.0

func (kvs KeyValuePairs) String(options ...*KeyValuePairOpts) string

type Table

type Table struct {
	Headers []Header
	Rows    [][]interface{}
	Spacing int // Spacing between rows. If 0 is provided, it defaults to 3.
}

Jump to

Keyboard shortcuts

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