output

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpperSnake

func UpperSnake(header string) string

Types

type Field

type Field struct {
	Name  string
	Value interface{}
}

func (*Field) ValueString

func (f *Field) ValueString() string

type FieldSelector

type FieldSelector func(Row) Row

func ByName

func ByName(fieldNames ...string) FieldSelector

type HeaderFormatter

type HeaderFormatter func(string) string

type Pager

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

func NewPager

func NewPager(bin string, out io.Writer) (*Pager, error)

func (*Pager) Close

func (p *Pager) Close() error

func (*Pager) Write

func (p *Pager) Write(b []byte) (n int, err error)

type Row

type Row []Field

func (Row) GetField

func (r Row) GetField(name string) Field

func (Row) Values added in v0.2.1

func (r Row) Values() []string

type RowModifier added in v0.2.0

type RowModifier func(Row) Row

func WithAdditionalFields added in v0.2.0

func WithAdditionalFields(fs ...Field) RowModifier

type Table

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

func NewTable

func NewTable(opts ...TableOption) (*Table, error)

func (*Table) Flush

func (t *Table) Flush() error

func (*Table) Write

func (t *Table) Write(r ToRower, mods ...RowModifier) error

type TableConfig

type TableConfig struct {
	Out        io.Writer
	Columns    []string
	Selector   FieldSelector
	HFormatter HeaderFormatter
	NoHeaders  bool
	PagerBin   string
}

func (*TableConfig) Default

func (c *TableConfig) Default()

func (*TableConfig) Option

func (c *TableConfig) Option(opts ...TableOption)

type TableOption

type TableOption interface {
	ApplyToTableConfig(*TableConfig)
}

type ToRower

type ToRower interface {
	ToRow() Row
}

type WithColumns

type WithColumns string

func (WithColumns) ApplyToTableConfig

func (wc WithColumns) ApplyToTableConfig(c *TableConfig)

type WithFieldSelector

type WithFieldSelector FieldSelector

func (WithFieldSelector) ApplyToTableConfig

func (wf WithFieldSelector) ApplyToTableConfig(c *TableConfig)

type WithHeaderFormatter

type WithHeaderFormatter HeaderFormatter

func (WithHeaderFormatter) ApplyToTableConfig

func (wh WithHeaderFormatter) ApplyToTableConfig(c *TableConfig)

type WithNoHeaders

type WithNoHeaders bool

func (WithNoHeaders) ApplyToTableConfig

func (wn WithNoHeaders) ApplyToTableConfig(c *TableConfig)

type WithOutput

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

func (WithOutput) ApplyToTableConfig

func (wo WithOutput) ApplyToTableConfig(c *TableConfig)

type WithPager

type WithPager string

func (WithPager) ApplyToTableConfig

func (wp WithPager) ApplyToTableConfig(c *TableConfig)

Jump to

Keyboard shortcuts

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