Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericMetric ¶
type GenericMetric[T NumericOrDuration] struct { Value T }
GenericMetric is a generic struct for metrics that can handle numeric values and time.Duration.
func (GenericMetric[T]) Compare ¶
func (g GenericMetric[T]) Compare(operator MetricOperator, value float64) (bool, error)
Compare performs a comparison operation between the GenericMetric's value and another value.
type Metric ¶
type Metric interface {
Compare(operator MetricOperator, value float64) (bool, error)
}
type MetricOperator ¶
type MetricOperator string
const ( MetricEqOperator MetricOperator = "eq" MetricNeOperator MetricOperator = "ne" MetricGtOperator MetricOperator = "gt" MetricGeOperator MetricOperator = "ge" MetricLtOperator MetricOperator = "lt" MetricLeOperator MetricOperator = "le" )
func ConvertToOperator ¶
func ConvertToOperator(op string) (MetricOperator, error)
type NumericOrDuration ¶
type NumericOrDuration interface { constraints.Integer | constraints.Float | time.Duration }
NumericOrDuration is a constraint that limits the types to numeric types or time.Duration.
Click to show internal directories.
Click to hide internal directories.