formatters

package
v0.2.84 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeOutputFilename added in v0.2.58

func ComputeOutputFilename(outputFile string, outputFileTemplate string, row types.Row, index int) (string, error)

func StartFormatIntoChannel added in v0.2.82

func StartFormatIntoChannel[T interface{ ~string }](
	ctx context.Context,
	formatter OutputFormatter,
) <-chan T

StartFormatIntoChannel outputs the data from an OutputFormatter into a channel. This is useful to render a table into a stream, for example when rendering larger outputs into HTML when serving.

Types

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)

	GetTable() (*types.Table, error)

	Output(ctx context.Context, w io.Writer) error

	ContentType() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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