Documentation ¶
Index ¶
- Variables
- func BashCompletionDistribution(cmd *cobra.Command, f *pflag.FlagSet, name string) error
- func BashCompletionLogFormat(cmd *cobra.Command, f *pflag.FlagSet, name string) error
- func BashCompletionLogLevel(cmd *cobra.Command, f *pflag.FlagSet, name string) error
- func ChoicesString(choices []string) string
- func DistributionChoices() []string
- func GetConstraints(f *pflag.FlagSet, name string) ([]*tester.Constraint, error)
- func GetConstraintsValue(v pflag.Value) ([]*tester.Constraint, error)
- func GetGrowth(f *pflag.FlagSet, name string) (tester.Growth, error)
- func GetGrowthValue(v pflag.Value) (tester.Growth, error)
- func LogFormatChoices() []string
- func LogLevelChoices() []string
- type ConstraintSliceValue
- type Distribution
- type DistributionGenerator
- type GrowthValue
- type LogFormat
- type LogLevel
- type LogOutput
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidGenerator = errors.New("invalid generator")
ErrInvalidGenerator is raised when an unknown generator is set.
var ErrInvalidLogFormat = errors.New("invalid log format")
ErrInvalidLogFormat is raised when an unknown format is set.
var ErrInvalidLogLevel = errors.New("invalid log level")
ErrInvalidLogLevel is raised when an unknown level is set.
var ErrInvalidType = errors.New("accessed flag type does not match")
ErrInvalidType is raised when user tries to get a value from a flag of a different type.
var ErrUndefined = errors.New("flag accessed but not defined")
ErrUndefined is raised when user tries to access an undefined flag.
Functions ¶
func BashCompletionDistribution ¶
BashCompletionDistribution adds bash completion to a distribution flag.
func BashCompletionLogFormat ¶
BashCompletionLogFormat adds bash completion to a distribution flag.
func BashCompletionLogLevel ¶
BashCompletionLogLevel adds bash completion to a distribution flag.
func ChoicesString ¶
ChoicesString converts choices list into printable text.
func DistributionChoices ¶
func DistributionChoices() []string
DistributionChoices returns a string representation of available generators.
func GetConstraints ¶
GetConstraints returns a constraints from a pflag set.
func GetConstraintsValue ¶
func GetConstraintsValue(v pflag.Value) ([]*tester.Constraint, error)
GetConstraintsValue returns a constraints from a pflag value.
func GetGrowthValue ¶
GetGrowthValue returns a growth from a pflag value.
func LogFormatChoices ¶
func LogFormatChoices() []string
LogFormatChoices returns a string representation of available formats.
func LogLevelChoices ¶
func LogLevelChoices() []string
LogLevelChoices returns a string representation of available levels.
Types ¶
type ConstraintSliceValue ¶
type ConstraintSliceValue struct { Parsers []tester.MetricParser // contains filtered or unexported fields }
ConstraintSliceValue is a pflag value storing constraints.
func NewConstraintSliceValue ¶
func NewConstraintSliceValue(parsers ...tester.MetricParser) *ConstraintSliceValue
NewConstraintSliceValue creates a new constraint slice value for pflag.
func (*ConstraintSliceValue) Set ¶
func (c *ConstraintSliceValue) Set(value string) error
Set validates given string given constraints and parses them to constraint structures using metric parsers.
func (*ConstraintSliceValue) String ¶
func (c *ConstraintSliceValue) String() string
func (*ConstraintSliceValue) Type ¶
func (c *ConstraintSliceValue) Type() string
Type returns the ConstraintSliceValue Type.
type Distribution ¶
type Distribution struct { Name string // contains filtered or unexported fields }
Distribution represents a interval generator flag value.
func NewDefaultDistribution ¶
func NewDefaultDistribution() *Distribution
NewDefaultDistribution returns new distribution flag with default values.
func (*Distribution) Get ¶
func (d *Distribution) Get() DistributionGenerator
Get returns a distibution generator.
func (*Distribution) Set ¶
func (d *Distribution) Set(value string) error
Set validates a given value and sets distribution (allows prefix matching).
func (*Distribution) String ¶
func (d *Distribution) String() string
type DistributionGenerator ¶
type DistributionGenerator = func(float64) bender.IntervalGenerator
DistributionGenerator represents distribution generator function.
func GetDistribution ¶
func GetDistribution(f *pflag.FlagSet, name string) (DistributionGenerator, error)
GetDistribution returns a distribution from a pflag set.
func GetDistributionValue ¶
func GetDistributionValue(v pflag.Value) (DistributionGenerator, error)
GetDistributionValue returns a distribution from a pflag value.
type GrowthValue ¶
GrowthValue represents growth flag value.
func (*GrowthValue) Set ¶
func (g *GrowthValue) Set(value string) error
Set validates a given growth and saves it.
func (*GrowthValue) String ¶
func (g *GrowthValue) String() string
type LogFormat ¶
LogFormat represents a log format flag value.
type LogLevel ¶
LogLevel represents a log level flag value.