ui

package
v9.22.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupPrefix   = "█"
	DetailsPrefix = "↳"

	SuccMark = "✓"
	FailMark = "✗"
)

Variables

View Source
var (
	StdColor   = color.New()            // Default color.
	ErrorColor = color.New(color.FgRed) // Errors.

	SuccColor     = color.New(color.FgGreen)             // Successful stuff.
	FailColor     = color.New(color.FgRed)               // Failed stuff.
	GrayColor     = color.New(color.Faint)               // Padding and disabled stuff.
	ValueColor    = color.New(color.FgCyan)              // Values of all kinds.
	ExtraColor    = color.New(color.FgCyan, color.Faint) // Extra annotations for values.
	ExtraKeyColor = color.New(color.Faint)               // Keys inside extra annotations.

	TypeColor    = color.New(color.FgYellow) // Syntax: Types.
	CommentColor = color.New(color.FgBlue)   // Syntax: Comments.
)
View Source
var (
	ErrStatEmptyString            = errors.New("Invalid stat, empty string")
	ErrStatUnknownFormat          = errors.New("Invalid stat, unknown format")
	ErrPercentileStatInvalidValue = errors.New("Invalid percentile stat value, accepts a number")
)
View Source
var TrendColumns = []TrendColumn{
	{"avg", func(s *stats.TrendSink) float64 { return s.Avg }},
	{"min", func(s *stats.TrendSink) float64 { return s.Min }},
	{"med", func(s *stats.TrendSink) float64 { return s.Med }},
	{"max", func(s *stats.TrendSink) float64 { return s.Max }},
	{"p(90)", func(s *stats.TrendSink) float64 { return s.P(0.90) }},
	{"p(95)", func(s *stats.TrendSink) float64 { return s.P(0.95) }},
}

Functions

func DisplayNameForMetric added in v0.18.0

func DisplayNameForMetric(m *stats.Metric) string

func Dump added in v0.18.0

func Dump(w io.Writer, v interface{})

func IndentForMetric added in v0.18.0

func IndentForMetric(m *stats.Metric) string

func NonTrendMetricValueForSum added in v0.18.0

func NonTrendMetricValueForSum(t time.Duration, timeUnit string, m *stats.Metric) (data string, extra []string)

func StrWidth added in v0.18.0

func StrWidth(s string) (n int)

Returns the actual width of the string.

func Summarize added in v0.18.0

func Summarize(w io.Writer, indent string, data SummaryData)

Summarizes a dataset and returns whether the test run was considered a success.

func SummarizeCheck added in v0.18.0

func SummarizeCheck(w io.Writer, indent string, check *lib.Check)

func SummarizeGroup added in v0.18.0

func SummarizeGroup(w io.Writer, indent string, group *lib.Group)

func SummarizeMetrics added in v0.18.0

func SummarizeMetrics(w io.Writer, indent string, t time.Duration, timeUnit string, metrics map[string]*stats.Metric)

func UpdateTrendColumns added in v0.19.0

func UpdateTrendColumns(stats []string)

UpdateTrendColumns updates the default trend columns with user defined ones

func VerifyTrendColumnStat added in v0.19.0

func VerifyTrendColumnStat(stat string) error

VerifyTrendColumnStat checks if stat is a valid trend column

Types

type Field added in v0.16.0

type Field interface {
	GetKey() string        // Key for the data map.
	GetLabel() string      // Label to print as the prompt.
	GetLabelExtra() string // Extra info for the label, eg. defaults.

	// Sanitize user input and return the field's native type.
	Clean(s string) (interface{}, error)
}

A Field in a form.

type Form added in v0.16.0

type Form struct {
	Banner string
	Fields []Field
}

A Form used to handle user interactions.

func (Form) Run added in v0.16.0

func (f Form) Run(r io.Reader, w io.Writer) (map[string]interface{}, error)

Runs the form against the specified input and output.

type ProgressBar

type ProgressBar struct {
	Width       int
	Progress    float64
	Left, Right func() string
}

func (ProgressBar) String

func (b ProgressBar) String() string

type StringField added in v0.16.0

type StringField struct {
	Key     string
	Label   string
	Default string

	// Length constraints.
	Min, Max int
}

func (StringField) Clean added in v0.16.0

func (f StringField) Clean(s string) (interface{}, error)

func (StringField) GetKey added in v0.16.0

func (f StringField) GetKey() string

func (StringField) GetLabel added in v0.16.0

func (f StringField) GetLabel() string

func (StringField) GetLabelExtra added in v0.16.0

func (f StringField) GetLabelExtra() string

type SummaryData added in v0.18.0

type SummaryData struct {
	Opts    lib.Options
	Root    *lib.Group
	Metrics map[string]*stats.Metric
	Time    time.Duration
}

SummaryData represents data passed to Summarize.

type TrendColumn added in v0.18.0

type TrendColumn struct {
	Key string
	Get func(s *stats.TrendSink) float64
}

Jump to

Keyboard shortcuts

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