(
&self,
other: &Box<dyn Value>,
group_op: &GroupComparisonOperator,
)
| 130 | } |
| 131 | |
| 132 | fn group_gt_op( |
| 133 | &self, |
| 134 | other: &Box<dyn Value>, |
| 135 | group_op: &GroupComparisonOperator, |
| 136 | ) -> Result<Box<dyn Value>, String> { |
| 137 | if other.is_array_of(|element_type| element_type.is_date_time()) { |
| 138 | let elements = &other.as_array().unwrap(); |
| 139 | let mut matches_count = 0; |
| 140 | for element in elements.iter() { |
| 141 | if self.value > element.as_date_time().unwrap() { |
| 142 | matches_count += 1; |
| 143 | if GroupComparisonOperator::Any.eq(group_op) { |
| 144 | break; |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | let result = match group_op { |
| 150 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 151 | GroupComparisonOperator::Any => matches_count > 0, |
| 152 | }; |
| 153 | |
| 154 | return Ok(Box::new(BoolValue::new(result))); |
| 155 | } |
| 156 | Err("Unexpected type to perform `>` with".to_string()) |
| 157 | } |
| 158 | |
| 159 | fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 160 | if let Some(other_text) = other.as_any().downcast_ref::<DateTimeValue>() { |
nothing calls this directly
no test coverage detected