formatters

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVOutputFormatter

type CSVOutputFormatter struct {
	Table *types.Table

	WithHeaders bool
	Separator   rune
	// contains filtered or unexported fields
}

func NewCSVOutputFormatter

func NewCSVOutputFormatter() *CSVOutputFormatter

func NewTSVOutputFormatter

func NewTSVOutputFormatter() *CSVOutputFormatter

func (*CSVOutputFormatter) AddRow

func (f *CSVOutputFormatter) AddRow(row types.Row)

func (*CSVOutputFormatter) AddTableMiddleware

func (f *CSVOutputFormatter) AddTableMiddleware(m middlewares2.TableMiddleware)

func (*CSVOutputFormatter) AddTableMiddlewareAtIndex

func (f *CSVOutputFormatter) AddTableMiddlewareAtIndex(i int, m middlewares2.TableMiddleware)

func (*CSVOutputFormatter) AddTableMiddlewareInFront

func (f *CSVOutputFormatter) AddTableMiddlewareInFront(m middlewares2.TableMiddleware)

func (*CSVOutputFormatter) Output

func (f *CSVOutputFormatter) Output() (string, error)

func (*CSVOutputFormatter) SetColumnOrder

func (f *CSVOutputFormatter) SetColumnOrder(columns []types.FieldName)

type JSONOutputFormatter

type JSONOutputFormatter struct {
	OutputIndividualRows bool
	Table                *types.Table
	// contains filtered or unexported fields
}

func NewJSONOutputFormatter

func NewJSONOutputFormatter(outputAsObjects bool) *JSONOutputFormatter

func (*JSONOutputFormatter) AddRow

func (J *JSONOutputFormatter) AddRow(row types.Row)

func (*JSONOutputFormatter) AddTableMiddleware

func (J *JSONOutputFormatter) AddTableMiddleware(mw middlewares.TableMiddleware)

func (*JSONOutputFormatter) AddTableMiddlewareAtIndex

func (J *JSONOutputFormatter) AddTableMiddlewareAtIndex(i int, mw middlewares.TableMiddleware)

func (*JSONOutputFormatter) AddTableMiddlewareInFront

func (J *JSONOutputFormatter) AddTableMiddlewareInFront(mw middlewares.TableMiddleware)

func (*JSONOutputFormatter) Output

func (J *JSONOutputFormatter) Output() (string, error)

func (*JSONOutputFormatter) SetColumnOrder

func (f *JSONOutputFormatter) SetColumnOrder(columns []types.FieldName)

type OutputFormatter

type OutputFormatter interface {
	// TODO(manuel, 2022-11-12) We need to be able to output to a directory / to a stream / to multiple files
	AddRow(row types.Row)

	SetColumnOrder(columnOrder []types.FieldName)

	// AddTableMiddleware adds a middleware at the end of the processing list
	AddTableMiddleware(m middlewares.TableMiddleware)
	AddTableMiddlewareInFront(m middlewares.TableMiddleware)
	AddTableMiddlewareAtIndex(i int, m middlewares.TableMiddleware)

	Output() (string, error)
}

type TableOutputFormatter

type TableOutputFormatter struct {
	Table *types.Table

	TableFormat string
	// contains filtered or unexported fields
}

func NewTableOutputFormatter

func NewTableOutputFormatter(tableFormat string) *TableOutputFormatter

func (*TableOutputFormatter) AddRow

func (tof *TableOutputFormatter) AddRow(row types.Row)

func (*TableOutputFormatter) AddTableMiddleware

func (tof *TableOutputFormatter) AddTableMiddleware(m middlewares.TableMiddleware)

func (*TableOutputFormatter) AddTableMiddlewareAtIndex

func (tof *TableOutputFormatter) AddTableMiddlewareAtIndex(i int, m middlewares.TableMiddleware)

func (*TableOutputFormatter) AddTableMiddlewareInFront

func (tof *TableOutputFormatter) AddTableMiddlewareInFront(m middlewares.TableMiddleware)

func (*TableOutputFormatter) Output

func (tof *TableOutputFormatter) Output() (string, error)

func (*TableOutputFormatter) SetColumnOrder

func (tof *TableOutputFormatter) SetColumnOrder(columnOrder []types.FieldName)

type TemplateFormatter

type TemplateFormatter struct {
	Template         string
	Table            *types.Table
	TemplateFuncMaps []template.FuncMap

	AdditionalData interface{}
	// contains filtered or unexported fields
}

func NewTemplateOutputFormatter

func NewTemplateOutputFormatter(template string, templateFuncMaps []template.FuncMap, additionalData interface{}) *TemplateFormatter

NewTemplateOutputFormatter creates a new TemplateFormatter.

TODO(manuel, 2023-02-19) This is quite an ugly constructor signature. See: https://github.com/go-go-golems/glazed/issues/147

func (*TemplateFormatter) AddRow

func (t *TemplateFormatter) AddRow(row types.Row)

func (*TemplateFormatter) AddTableMiddleware

func (t *TemplateFormatter) AddTableMiddleware(m middlewares.TableMiddleware)

func (*TemplateFormatter) AddTableMiddlewareAtIndex

func (t *TemplateFormatter) AddTableMiddlewareAtIndex(i int, m middlewares.TableMiddleware)

func (*TemplateFormatter) AddTableMiddlewareInFront

func (t *TemplateFormatter) AddTableMiddlewareInFront(m middlewares.TableMiddleware)

func (*TemplateFormatter) Output

func (t *TemplateFormatter) Output() (string, error)

func (*TemplateFormatter) SetColumnOrder

func (t *TemplateFormatter) SetColumnOrder(columnOrder []types.FieldName)

type YAMLOutputFormatter

type YAMLOutputFormatter struct {
	Table *types.Table
	// contains filtered or unexported fields
}

func NewYAMLOutputFormatter

func NewYAMLOutputFormatter() *YAMLOutputFormatter

func (*YAMLOutputFormatter) AddRow

func (Y *YAMLOutputFormatter) AddRow(row types.Row)

func (*YAMLOutputFormatter) AddTableMiddleware

func (Y *YAMLOutputFormatter) AddTableMiddleware(mw middlewares.TableMiddleware)

func (*YAMLOutputFormatter) AddTableMiddlewareAtIndex

func (Y *YAMLOutputFormatter) AddTableMiddlewareAtIndex(i int, mw middlewares.TableMiddleware)

func (*YAMLOutputFormatter) AddTableMiddlewareInFront

func (Y *YAMLOutputFormatter) AddTableMiddlewareInFront(mw middlewares.TableMiddleware)

func (*YAMLOutputFormatter) Output

func (Y *YAMLOutputFormatter) Output() (string, error)

func (*YAMLOutputFormatter) SetColumnOrder

func (f *YAMLOutputFormatter) SetColumnOrder(columns []types.FieldName)

Jump to

Keyboard shortcuts

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