MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / evaluate

Method evaluate

nodedb/src/event/alert/types.rs:83–92  ·  view source on GitHub ↗

Evaluate the comparison.

(&self, value: f64, threshold: f64)

Source from the content-addressed store, hash-verified

81
82 /// Evaluate the comparison.
83 pub fn evaluate(&self, value: f64, threshold: f64) -> bool {
84 match self {
85 Self::Gt => value > threshold,
86 Self::Gte => value >= threshold,
87 Self::Lt => value < threshold,
88 Self::Lte => value <= threshold,
89 Self::Eq => (value - threshold).abs() < f64::EPSILON,
90 Self::Neq => (value - threshold).abs() >= f64::EPSILON,
91 }
92 }
93
94 /// SQL representation.
95 pub fn as_sql(&self) -> &'static str {

Callers 1

evaluate_alertFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected