Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractNumericComparisonIndex(str string) int
- func ExtractStringComparisonIndex(str string) int
- func PrefixedNumericComparisonChoices(prefix string) []string
- func PrefixedStringComparisonChoices(prefix, notPrefix string) []string
- type Number
- type NumberData
- type NumericComparison
- func (n NumericComparison) AltDescribe(qualifier fxp.Int) string
- func (n NumericComparison) AltString() string
- func (n NumericComparison) Describe(qualifier fxp.Int) string
- func (n NumericComparison) EnsureValid() NumericComparison
- func (n NumericComparison) Matches(qualifier, data fxp.Int) bool
- func (n NumericComparison) String() string
- type StringComparison
- func (s StringComparison) AltString() string
- func (s StringComparison) Describe(qualifier string) string
- func (s StringComparison) DescribeWithPrefix(prefix, notPrefix, qualifier string) string
- func (s StringComparison) EnsureValid() StringComparison
- func (s StringComparison) IsNotType() bool
- func (s StringComparison) Matches(qualifier, data string) bool
- func (s StringComparison) String() string
- type Text
- func (t Text) Hash(h hash.Hash)
- func (t Text) Matches(replacements map[string]string, value string) bool
- func (t Text) MatchesList(replacements map[string]string, value ...string) bool
- func (t Text) ShouldOmit() bool
- func (t Text) String(replacements map[string]string) string
- func (t Text) StringWithPrefix(replacements map[string]string, prefix, notPrefix string) string
- func (t *Text) UnmarshalJSON(data []byte) error
- type TextData
- type Weight
- type WeightData
Constants ¶
const ( AnyNumber = NumericComparison("") EqualsNumber = NumericComparison("is") NotEqualsNumber = NumericComparison("is_not") AtLeastNumber = NumericComparison("at_least") AtMostNumber = NumericComparison("at_most") )
Possible NumericComparison values.
const ( AnyText = StringComparison("") IsText = StringComparison("is") IsNotText = StringComparison("is_not") ContainsText = StringComparison("contains") DoesNotContainText = StringComparison("does_not_contain") StartsWithText = StringComparison("starts_with") DoesNotStartWithText = StringComparison("does_not_start_with") EndsWithText = StringComparison("ends_with") DoesNotEndWithText = StringComparison("does_not_end_with") )
Possible StringComparison values.
Variables ¶
var AllNumericComparisons = []NumericComparison{ AnyNumber, EqualsNumber, NotEqualsNumber, AtLeastNumber, AtMostNumber, }
AllNumericComparisons is the complete set of NumericComparison values.
var AllStringComparisons = []StringComparison{ AnyText, IsText, IsNotText, ContainsText, DoesNotContainText, StartsWithText, DoesNotStartWithText, EndsWithText, DoesNotEndWithText, }
AllStringComparisons is the complete set of StringComparison values.
Functions ¶
func ExtractNumericComparisonIndex ¶ added in v5.26.0
ExtractNumericComparisonIndex extracts the index from a string.
func ExtractStringComparisonIndex ¶ added in v5.26.0
ExtractStringComparisonIndex extracts the index from a string.
func PrefixedNumericComparisonChoices ¶ added in v5.26.0
PrefixedNumericComparisonChoices returns the set of NumericComparison choices as strings with a prefix.
func PrefixedStringComparisonChoices ¶ added in v5.26.0
PrefixedStringComparisonChoices returns the set of StringCompareType choices as strings with a prefix.
Types ¶
type Number ¶ added in v5.26.0
type Number struct {
NumberData
}
Number holds the criteria for matching a number.
func (Number) Matches ¶ added in v5.26.0
Matches performs a comparison and returns true if the data matches.
func (Number) ShouldOmit ¶ added in v5.26.0
ShouldOmit implements json.Omitter.
func (*Number) UnmarshalJSON ¶ added in v5.26.0
UnmarshalJSON implements json.Unmarshaler.
type NumberData ¶ added in v5.26.0
type NumberData struct { Compare NumericComparison `json:"compare,omitempty"` Qualifier fxp.Int `json:"qualifier,omitempty"` }
NumberData holds the criteria for matching a number that should be written to disk.
type NumericComparison ¶ added in v5.26.0
type NumericComparison string
NumericComparison holds the type for a numeric comparison.
func (NumericComparison) AltDescribe ¶ added in v5.26.0
func (n NumericComparison) AltDescribe(qualifier fxp.Int) string
AltDescribe returns an alternate description of this NumericCompareType using a qualifier.
func (NumericComparison) AltString ¶ added in v5.26.0
func (n NumericComparison) AltString() string
AltString returns an alternate string for this.
func (NumericComparison) Describe ¶ added in v5.26.0
func (n NumericComparison) Describe(qualifier fxp.Int) string
Describe returns a description of this NumericCompareType using a qualifier.
func (NumericComparison) EnsureValid ¶ added in v5.26.0
func (n NumericComparison) EnsureValid() NumericComparison
EnsureValid ensures this is of a known value.
func (NumericComparison) Matches ¶ added in v5.26.0
func (n NumericComparison) Matches(qualifier, data fxp.Int) bool
Matches performs a comparison and returns true if the data matches.
func (NumericComparison) String ¶ added in v5.26.0
func (n NumericComparison) String() string
String implements fmt.Stringer.
type StringComparison ¶ added in v5.26.0
type StringComparison string
StringComparison holds the type for a string comparison.
func (StringComparison) AltString ¶ added in v5.26.0
func (s StringComparison) AltString() string
AltString provides a variant of String() for the not cases.
func (StringComparison) Describe ¶ added in v5.26.0
func (s StringComparison) Describe(qualifier string) string
Describe returns a description of this StringCompareType using a qualifier.
func (StringComparison) DescribeWithPrefix ¶ added in v5.26.0
func (s StringComparison) DescribeWithPrefix(prefix, notPrefix, qualifier string) string
DescribeWithPrefix returns a description of this StringCompareType using a qualifier and prefix.
func (StringComparison) EnsureValid ¶ added in v5.26.0
func (s StringComparison) EnsureValid() StringComparison
EnsureValid ensures this is of a known value.
func (StringComparison) IsNotType ¶ added in v5.26.0
func (s StringComparison) IsNotType() bool
IsNotType returns true if this is a "not" type.
func (StringComparison) Matches ¶ added in v5.26.0
func (s StringComparison) Matches(qualifier, data string) bool
Matches performs a comparison and returns true if the data matches.
func (StringComparison) String ¶ added in v5.26.0
func (s StringComparison) String() string
String implements fmt.Stringer.
type Text ¶ added in v5.26.0
type Text struct {
TextData
}
Text holds the criteria for matching text.
func (Text) Matches ¶ added in v5.26.0
Matches performs a comparison and returns true if the data matches.
func (Text) MatchesList ¶ added in v5.26.0
MatchesList performs a comparison and returns true if the data matches.
func (Text) ShouldOmit ¶ added in v5.26.0
ShouldOmit implements json.Omitter.
func (Text) StringWithPrefix ¶ added in v5.26.0
StringWithPrefix returns a string representation of this criteria with a prefix.
func (*Text) UnmarshalJSON ¶ added in v5.26.0
UnmarshalJSON implements json.Unmarshaler.
type TextData ¶ added in v5.26.0
type TextData struct { Compare StringComparison `json:"compare,omitempty"` Qualifier string `json:"qualifier,omitempty"` }
TextData holds the criteria for matching text that should be written to disk.
type Weight ¶
type Weight struct {
WeightData
}
Weight holds the criteria for matching a weight.
func (*Weight) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type WeightData ¶
type WeightData struct { Compare NumericComparison `json:"compare,omitempty"` Qualifier fxp.Weight `json:"qualifier,omitempty"` }
WeightData holds the criteria for matching a weight that should be written to disk.