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

Method group_lt_op

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_boolMethod · 0.80
is_boolMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected