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

Method group_gte_op

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

Source from the content-addressed store, hash-verified

259 }
260
261 fn group_gte_op(
262 &self,
263 other: &Box<dyn Value>,
264 group_op: &GroupComparisonOperator,
265 ) -> Result<Box<dyn Value>, String> {
266 if other.is_array_of(|element_type| element_type.is_int()) {
267 let elements = &other.as_array().unwrap();
268 let mut matches_count = 0;
269 for element in elements.iter() {
270 if self.value >= element.as_int().unwrap() {
271 matches_count += 1;
272 if GroupComparisonOperator::Any.eq(group_op) {
273 break;
274 }
275 }
276 }
277
278 let result = match group_op {
279 GroupComparisonOperator::All => matches_count == elements.len(),
280 GroupComparisonOperator::Any => matches_count > 0,
281 };
282
283 return Ok(Box::new(BoolValue::new(result)));
284 }
285 Err("Unexpected type to perform `>=` with".to_string())
286 }
287
288 fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
289 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