formatter

package
v0.0.0-...-e5cbec8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableFormatKey  = "table"
	RawFormatKey    = "raw"
	CSVFormatKey    = "csv"
	PrettyFormatKey = "pretty"
)

Format keys used to specify certain kinds of output formats

View Source
const (
	InfluxDBFormatKey = "influxdb"
)
View Source
const (
	TaurusFormatKey = "taurus"
)

Variables

This section is empty.

Functions

func InfluxdbWrite

func InfluxdbWrite(ctx Context, report fio.Report, tags string) error

InfluxdbWrite writes formatted summaries using the Context

func KtoMB

func KtoMB(k int) float32

func SummaryWrite

func SummaryWrite(ctx Context, summary fio.Report) error

SummaryWrite writes formatted summaries using the Context

func TaurusGroup

func TaurusGroup(j fio.Job) (*taurus.Group, error)

func TaurusReport

func TaurusReport(r fio.Report, reportURL string) (*taurus.Report, error)

func TaurusWrite

func TaurusWrite(ctx Context, report fio.Report, reportURL string) error

TaurusWrite writes formatted summaries using the Context

Types

type Context

type Context struct {
	// Output is the output stream to which the formatted string is written.
	Output io.Writer
	// Format is used to choose raw, table or custom format for the output.
	Format Format
	// Trunc when set to true will truncate the output of certain fields such as Container ID.
	Trunc bool
	// contains filtered or unexported fields
}

Context contains information required by the formatter to print the output as desired.

func (*Context) Write

func (c *Context) Write(sub subContext, f SubFormat) error

Write the template to the buffer using this Context

type Format

type Format string

Format is the format string rendered using the Context

func NewInfluxdbFormat

func NewInfluxdbFormat(source string, quiet bool) Format

NewInfluxdbFormat returns a format for use with a influxdb Context

func NewSummaryFormat

func NewSummaryFormat(source string, quiet bool) Format

NewSummaryFormat returns a format for use with a summary Context

func NewTaurusFormat

func NewTaurusFormat() Format

NewTaurusFormat returns a format for use with a summary Context

func (Format) Contains

func (f Format) Contains(sub string) bool

Contains returns true if the format contains the substring

func (Format) IsCSV

func (f Format) IsCSV() bool

IsCSV returns true if the format is a table-type format

func (Format) IsTable

func (f Format) IsTable() bool

IsTable returns true if the format is a table-type format

type HeaderContext

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

HeaderContext provides the subContext interface for managing headers

func (*HeaderContext) AddHeader

func (c *HeaderContext) AddHeader(header string)

AddHeader adds another column to the header

func (*HeaderContext) CSVHeader

func (c *HeaderContext) CSVHeader() string

CSVHeader returns the header as a comma-delimited string

func (*HeaderContext) TabHeader

func (c *HeaderContext) TabHeader() string

TabHeader returns the header as a tab-delimited string

type SubFormat

type SubFormat func(func(subContext) error) error

SubFormat is a function type accepted by Write()

Jump to

Keyboard shortcuts

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