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

Method group_gt_op

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

Source from the content-addressed store, hash-verified

224 }
225
226 fn group_gt_op(
227 &self,
228 other: &Box<dyn Value>,
229 group_op: &GroupComparisonOperator,
230 ) -> Result<Box<dyn Value>, String> {
231 if other.is_array_of(|element_type| element_type.is_int()) {
232 let elements = &other.as_array().unwrap();
233 let mut matches_count = 0;
234 for element in elements.iter() {
235 if self.value > element.as_int().unwrap() {
236 matches_count += 1;
237 if GroupComparisonOperator::Any.eq(group_op) {
238 break;
239 }
240 }
241 }
242
243 let result = match group_op {
244 GroupComparisonOperator::All => matches_count == elements.len(),
245 GroupComparisonOperator::Any => matches_count > 0,
246 };
247
248 return Ok(Box::new(BoolValue::new(result)));
249 }
250 Err("Unexpected type to perform `>` with".to_string())
251 }
252
253 fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
254 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