criteria

package
v5.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnyNumber       = NumericComparison("")
	EqualsNumber    = NumericComparison("is")
	NotEqualsNumber = NumericComparison("is_not")
	AtLeastNumber   = NumericComparison("at_least")
	AtMostNumber    = NumericComparison("at_most")
)

Possible NumericComparison values.

View Source
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

AllNumericComparisons is the complete set of NumericComparison values.

AllStringComparisons is the complete set of StringComparison values.

Functions

func ExtractNumericComparisonIndex added in v5.26.0

func ExtractNumericComparisonIndex(str string) int

ExtractNumericComparisonIndex extracts the index from a string.

func ExtractStringComparisonIndex added in v5.26.0

func ExtractStringComparisonIndex(str string) int

ExtractStringComparisonIndex extracts the index from a string.

func PrefixedNumericComparisonChoices added in v5.26.0

func PrefixedNumericComparisonChoices(prefix string) []string

PrefixedNumericComparisonChoices returns the set of NumericComparison choices as strings with a prefix.

func PrefixedStringComparisonChoices added in v5.26.0

func PrefixedStringComparisonChoices(prefix, notPrefix string) []string

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) AltString added in v5.26.0

func (n Number) AltString() string

AltString returns the alternate description.

func (Number) Hash added in v5.26.0

func (n Number) Hash(h hash.Hash)

Hash writes this object's contents into the hasher.

func (Number) Matches added in v5.26.0

func (n Number) Matches(value fxp.Int) bool

Matches performs a comparison and returns true if the data matches.

func (Number) ShouldOmit added in v5.26.0

func (n Number) ShouldOmit() bool

ShouldOmit implements json.Omitter.

func (Number) String added in v5.26.0

func (n Number) String() string

func (*Number) UnmarshalJSON added in v5.26.0

func (n *Number) UnmarshalJSON(data []byte) error

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) Hash added in v5.26.0

func (t Text) Hash(h hash.Hash)

Hash writes this object's contents into the hasher.

func (Text) Matches added in v5.26.0

func (t Text) Matches(replacements map[string]string, value string) bool

Matches performs a comparison and returns true if the data matches.

func (Text) MatchesList added in v5.26.0

func (t Text) MatchesList(replacements map[string]string, value ...string) bool

MatchesList performs a comparison and returns true if the data matches.

func (Text) ShouldOmit added in v5.26.0

func (t Text) ShouldOmit() bool

ShouldOmit implements json.Omitter.

func (Text) String added in v5.26.0

func (t Text) String(replacements map[string]string) string

func (Text) StringWithPrefix added in v5.26.0

func (t Text) StringWithPrefix(replacements map[string]string, prefix, notPrefix string) string

StringWithPrefix returns a string representation of this criteria with a prefix.

func (*Text) UnmarshalJSON added in v5.26.0

func (t *Text) UnmarshalJSON(data []byte) error

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) Hash added in v5.26.0

func (w Weight) Hash(h hash.Hash)

Hash writes this object's contents into the hasher.

func (Weight) Matches

func (w Weight) Matches(value fxp.Weight) bool

Matches performs a comparison and returns true if the data matches.

func (Weight) ShouldOmit

func (w Weight) ShouldOmit() bool

ShouldOmit implements json.Omitter.

func (Weight) String

func (w Weight) String() string

func (*Weight) UnmarshalJSON

func (w *Weight) UnmarshalJSON(data []byte) error

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.

Jump to

Keyboard shortcuts

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