Documentation ¶
Overview ¶
Package intcondition exposes some common integer condition implementations.
Index ¶
Constants ¶
View Source
const ( // Equal is the sentinel key identifying an int == comparison. Equal = "==" // GreaterThan is the sentinel key identifying the int > comparison. GreaterThan = ">" // GreaterThanOrEqual is the sentinel key identifying the int >= comparison. GreaterThanOrEqual = ">=" // ComparisonConditionKey is the sentinel key indicating the condition type is an int comparison. ComparisonConditionKey = "intComparison" // IsIntConditionKey is the sentinel key identifying that the condition is checking that the argument is an integer. IsIntConditionKey = "isInt" // LessThan is the sentinel key identifying the int < comparison. LessThan = "<" // LessThanOrEqual is the sentinel key identifying the int <= comparison. LessThanOrEqual = "<=" // NotEqual is the sentinel key identifying the int != comparison. NotEqual = "!=" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComparisonCondition ¶
type ComparisonCondition struct { Type string `json:"type" yaml:"type"` Input int `json:"input" yaml:"input"` Comparison string `json:"comparison" yaml:"comparison"` }
ComparisonCondition is an implementation of the condition.Condition interface which converts a match string to an integer, then checks integer equality against Input.
func NewComparisonCondition ¶
func NewComparisonCondition(input int, comparison string) *ComparisonCondition
NewComparisonCondition creates an ComparisonCondition.
type IsIntCondition ¶
type IsIntCondition struct { // Type stores the sentinel which represents the type of Condition implemented. Type string `json:"type" yaml:"type"` }
IsIntCondition is an implementation of the condition.Condition interface which evaluates whether a match string is an integer. Although IsIntCondition is exported for serialization purposes, it is recommended to instantiate new instances of IsIntCondition using NewIsIntCondition.
func NewIsIntCondition ¶
func NewIsIntCondition() *IsIntCondition
NewIsIntCondition creates an IsIntCondition.
Click to show internal directories.
Click to hide internal directories.