(
&self,
other: &Box<dyn Value>,
group_op: &GroupComparisonOperator,
)
| 222 | } |
| 223 | |
| 224 | fn group_lt_op( |
| 225 | &self, |
| 226 | other: &Box<dyn Value>, |
| 227 | group_op: &GroupComparisonOperator, |
| 228 | ) -> Result<Box<dyn Value>, String> { |
| 229 | if other.is_array_of(|element_type| element_type.is_date()) { |
| 230 | let elements = &other.as_array().unwrap(); |
| 231 | let mut matches_count = 0; |
| 232 | for element in elements.iter() { |
| 233 | if self.timestamp < element.as_date().unwrap() { |
| 234 | matches_count += 1; |
| 235 | if GroupComparisonOperator::Any.eq(group_op) { |
| 236 | break; |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | let result = match group_op { |
| 242 | GroupComparisonOperator::All => matches_count == elements.len(), |
| 243 | GroupComparisonOperator::Any => matches_count > 0, |
| 244 | }; |
| 245 | |
| 246 | return Ok(Box::new(BoolValue::new(result))); |
| 247 | } |
| 248 | Err("Unexpected type to perform `<` with".to_string()) |
| 249 | } |
| 250 | |
| 251 | fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 252 | if let Some(other_text) = other.as_any().downcast_ref::<DateValue>() { |
no test coverage detected