MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / group_lt_op

Method group_lt_op

crates/gitql-core/src/values/integer.rs:296–321  ·  view source on GitHub ↗
(
        &self,
        other: &Box<dyn Value>,
        group_op: &GroupComparisonOperator,
    )

Source from the content-addressed store, hash-verified

294 }
295
296 fn group_lt_op(
297 &self,
298 other: &Box<dyn Value>,
299 group_op: &GroupComparisonOperator,
300 ) -> Result<Box<dyn Value>, String> {
301 if other.is_array_of(|element_type| element_type.is_int()) {
302 let elements = &other.as_array().unwrap();
303 let mut matches_count = 0;
304 for element in elements.iter() {
305 if self.value < element.as_int().unwrap() {
306 matches_count += 1;
307 if GroupComparisonOperator::Any.eq(group_op) {
308 break;
309 }
310 }
311 }
312
313 let result = match group_op {
314 GroupComparisonOperator::All => matches_count == elements.len(),
315 GroupComparisonOperator::Any => matches_count > 0,
316 };
317
318 return Ok(Box::new(BoolValue::new(result)));
319 }
320 Err("Unexpected type to perform `<` with".to_string())
321 }
322
323 fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
324 if let Some(other_bool) = other.as_any().downcast_ref::<IntValue>() {

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_intMethod · 0.80
is_intMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected