table

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 Opts added in v0.13.0

type Opts struct {
	Sort *bool // default is true
}

type Table

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

func (*Table) Format added in v0.13.0

func (t *Table) Format(opts ...*Opts) (string, error)

func (*Table) MustFormat added in v0.13.0

func (t *Table) MustFormat(opts ...*Opts) string

Return the error message as a string

func (*Table) MustPrint added in v0.13.0

func (t *Table) MustPrint()

Prints the error message as a string (if there is an error)

Jump to

Keyboard shortcuts

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