Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayNameForMetric(m *stats.Metric) string
- func Dump(w io.Writer, v interface{})
- func IndentForMetric(m *stats.Metric) string
- func NonTrendMetricValueForSum(t time.Duration, timeUnit string, m *stats.Metric) (data string, extra []string)
- func StrWidth(s string) (n int)
- func Summarize(w io.Writer, indent string, data SummaryData)
- func SummarizeCheck(w io.Writer, indent string, check *lib.Check)
- func SummarizeGroup(w io.Writer, indent string, group *lib.Group)
- func SummarizeMetrics(w io.Writer, indent string, t time.Duration, timeUnit string, ...)
- func UpdateTrendColumns(stats []string)
- func VerifyTrendColumnStat(stat string) error
- type Field
- type Form
- type PasswordField
- type ProgressBar
- type StringField
- type SummaryData
- type TrendColumn
Constants ¶
const ( GroupPrefix = "█" DetailsPrefix = "↳" SuccMark = "✓" FailMark = "✗" )
Variables ¶
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. )
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") )
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 IndentForMetric ¶ added in v0.18.0
func NonTrendMetricValueForSum ¶ added in v0.18.0
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 SummarizeGroup ¶ added in v0.18.0
func SummarizeMetrics ¶ added in v0.18.0
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
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. GetContents(io.Reader) (string, error) // Read the field contents from the supplied reader // Sanitize user input and return the field's native type. Clean(s string) (interface{}, error) }
A Field in a form.
type PasswordField ¶ added in v0.23.0
PasswordField masks password input
func (PasswordField) Clean ¶ added in v0.23.0
func (f PasswordField) Clean(s string) (interface{}, error)
Clean just checks if the minimum length is exceeded, it doesn't trim the string!
func (PasswordField) GetContents ¶ added in v0.23.0
func (f PasswordField) GetContents(r io.Reader) (string, error)
GetContents simply reads a string in cleartext from the supplied reader
func (PasswordField) GetKey ¶ added in v0.23.0
func (f PasswordField) GetKey() string
GetKey returns the field's key
func (PasswordField) GetLabel ¶ added in v0.23.0
func (f PasswordField) GetLabel() string
GetLabel returns the field's label
func (PasswordField) GetLabelExtra ¶ added in v0.23.0
func (f PasswordField) GetLabelExtra() string
GetLabelExtra doesn't return anything so we don't expose the current password
type ProgressBar ¶
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 }
StringField is just a simple field for reading cleartext strings
func (StringField) Clean ¶ added in v0.16.0
func (f StringField) Clean(s string) (interface{}, error)
Clean trims the spaces in the string and checks for min and max length
func (StringField) GetContents ¶ added in v0.23.0
func (f StringField) GetContents(r io.Reader) (string, error)
GetContents simply reads a string in cleartext from the supplied reader It's compllicated and doesn't use t he bufio utils because we can't read ahead of the newline and consume more of the stdin, because we'll mess up the next form field
func (StringField) GetKey ¶ added in v0.16.0
func (f StringField) GetKey() string
GetKey returns the field's key
func (StringField) GetLabel ¶ added in v0.16.0
func (f StringField) GetLabel() string
GetLabel returns the field's label
func (StringField) GetLabelExtra ¶ added in v0.16.0
func (f StringField) GetLabelExtra() string
GetLabelExtra returns the field's default value