2020-11-10 11:28:59 +01:00
|
|
|
package analyse
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
)
|
|
|
|
|
2020-11-12 14:08:27 +01:00
|
|
|
// ErrCompareMatching should be thrown if the compare character can not be used.
|
|
|
|
var ErrCompareMatching = errors.New("The compare character does not match neither '>', '<', '=' or '!='")
|
2020-11-10 11:28:59 +01:00
|
|
|
|
|
|
|
type compareFloatFunc func(want float64) bool
|
2020-11-11 22:39:37 +01:00
|
|
|
type compareIntFunc func(want int) bool
|
2020-11-10 11:28:59 +01:00
|
|
|
|
2020-11-12 14:08:27 +01:00
|
|
|
// Rule represents a generic rule that can be extended by a more specified rule.
|
2020-11-10 11:28:59 +01:00
|
|
|
type Rule struct {
|
|
|
|
Name string
|
|
|
|
Description string
|
|
|
|
Deactivated bool
|
|
|
|
// Compare has to be '>', '<', '=' or '!='
|
|
|
|
Compare string
|
|
|
|
}
|
2020-11-14 18:39:46 +01:00
|
|
|
|
|
|
|
// IsDeactivated returns the status if the rule is deactivated or not.
|
|
|
|
func (r Rule) IsDeactivated() bool {
|
|
|
|
return r.Deactivated
|
|
|
|
}
|