output

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnDef

type ColumnDef struct {
	Name     string
	Template string
}

type Content

type Content struct {
	Zone  string
	ID    string
	Value interface{}
}

type Contents

type Contents []*Content

func (*Contents) Sort

func (c *Contents) Sort(zones []string)

func (*Contents) Values

func (c *Contents) Values() []interface{}

type DefaultFormatter

type DefaultFormatter struct{}

func (*DefaultFormatter) ColumnDefs

func (f *DefaultFormatter) ColumnDefs() []ColumnDef

func (*DefaultFormatter) ExcludeFields

func (f *DefaultFormatter) ExcludeFields() []string

func (*DefaultFormatter) IncludeFields

func (f *DefaultFormatter) IncludeFields() []string

type Formatter

type Formatter interface {
	ColumnDefs() []ColumnDef
}

type Option

type Option interface {
	OutputTypeFlagValue() string
	FormatFlagValue() string
	QuietFlagValue() bool
	QueryFlagValue() string
	QueryDriverFlagValue() string
}

type Output

type Output interface {
	Print(Contents) error
}

func NewDiscardOutput

func NewDiscardOutput() Output

func NewFreeOutput

func NewFreeOutput(out io.Writer, err io.Writer, option Option) Output

func NewIDOutput

func NewIDOutput(out io.Writer, err io.Writer) Output

func NewJSONOutput

func NewJSONOutput(out io.Writer, err io.Writer, noColor bool, query string, driver string) Output

func NewTableOutput

func NewTableOutput(out io.Writer, err io.Writer, columnDefs []ColumnDef) Output

func NewYAMLOutput

func NewYAMLOutput(out io.Writer, err io.Writer) Output

type SimpleTableWriter

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

SimpleTableWriter is write table that output one line for each value

func NewSimpleTableWriter

func NewSimpleTableWriter(out io.Writer, columnDefs []ColumnDef) *SimpleTableWriter

func (*SimpleTableWriter) CellValue

func (w *SimpleTableWriter) CellValue(v interface{}, def ColumnDef) (string, error)

CellValue 指定のColumnDefを用いてvから出力を組み立てる

NOTE: pkg/cmd/commands/*でColumnDefのテストをするためにエクスポートしている

Jump to

Keyboard shortcuts

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