Documentation
¶
Overview ¶
Package value provides types and functionality to work with config values.
Index ¶
- type Integer
- type Pattern
- type Range
- type String
- type Strings
- func (s Strings) Empty() bool
- func (s Strings) Equal(other []string) bool
- func (s Strings) Exact() []string
- func (s Strings) Has(v string, vv ...string) bool
- func (s Strings) Level() issue.Type
- func (s Strings) String() string
- func (s Strings) Validate() error
- func (s Strings) WithLevel(lvl issue.Type) Strings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Integer ¶
type Integer struct {
// contains filtered or unexported fields
}
Integer represents config integer value that can be configured with issue type level to alert on linting.
func NewInteger ¶
NewInteger creates a new config integer value with issue type level and exact value.
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
Pattern represents config regexp pattern value that can be configured with issue type level to alert on linting.
func NewPattern ¶
NewPattern creates a new config regexp pattern value with issue type level and compiled regexp expression.
func (Pattern) Match ¶
Match defines whether the compiled regexp expression matches the provided string.
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range represents an inclusive integer interval [min, max] that can be configured with an issue type level to alert on linting.
Range is immutable and validates its invariant on every method call: min must not be greater than max.
func (Range) Above ¶
Above reports whether n is strictly greater than the upper bound of the interval.
Panics if min is greater than max.
func (Range) Below ¶
Below reports whether n is strictly less than the lower bound of the interval.
Panics if min is greater than max.
func (Range) Empty ¶
Empty defines whether the range is empty (min and max are zeros).
Panics if min is greater than max.
func (Range) Fit ¶
Fit reports whether n falls within the inclusive interval [min, max].
Panics if min is greater than max.
func (Range) String ¶
String returns the canonical "min-max" representation of the interval.
Panics if min is greater than max.
func (Range) Validate ¶ added in v0.1.2
Validate checks the range configuration for correctness.
Returns an error wrapping ErrInvalidConfig if the issue type level is specified but unknown, if min or max is lower than zero or if min is greater than max. When several checks fail, the error of the first failed check in that order is returned.
Unlike Empty, String, Fit, Below and Above, Validate does not panic on invalid bounds and is intended to report them.
type String ¶
type String struct {
// contains filtered or unexported fields
}
String represents config string value that can be configured with issue type level to alert on linting.
type Strings ¶
type Strings struct {
// contains filtered or unexported fields
}
Strings represents a config value that is a slice of strings that can be configured with an issue type level to alert on linting.
func NewStrings ¶
NewStrings creates a new config value from a slice of string values with the given issue type level.
func (Strings) String ¶
String returns a comma-separated string representation of the slice of exact values.