Parse from SQL operator string.
(s: &str)
| 68 | impl CompareOp { |
| 69 | /// Parse from SQL operator string. |
| 70 | pub fn parse(s: &str) -> Option<Self> { |
| 71 | match s.trim() { |
| 72 | ">" => Some(Self::Gt), |
| 73 | ">=" => Some(Self::Gte), |
| 74 | "<" => Some(Self::Lt), |
| 75 | "<=" => Some(Self::Lte), |
| 76 | "=" | "==" => Some(Self::Eq), |
| 77 | "!=" | "<>" => Some(Self::Neq), |
| 78 | _ => None, |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | /// Evaluate the comparison. |
| 83 | pub fn evaluate(&self, value: f64, threshold: f64) -> bool { |
no outgoing calls