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

Method group_lt_op

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

Source from the content-addressed store, hash-verified

232 }
233
234 fn group_lt_op(
235 &self,
236 other: &Box<dyn Value>,
237 group_op: &GroupComparisonOperator,
238 ) -> Result<Box<dyn Value>, String> {
239 if other.is_array_of(|element_type| element_type.is_float()) {
240 let elements = &other.as_array().unwrap();
241 let mut matches_count = 0;
242 for element in elements.iter() {
243 if self.value < element.as_float().unwrap() {
244 matches_count += 1;
245 if GroupComparisonOperator::Any.eq(group_op) {
246 break;
247 }
248 }
249 }
250
251 let result = match group_op {
252 GroupComparisonOperator::All => matches_count == elements.len(),
253 GroupComparisonOperator::Any => matches_count > 0,
254 };
255
256 return Ok(Box::new(BoolValue::new(result)));
257 }
258 Err("Unexpected type to perform `<` with".to_string())
259 }
260
261 fn lte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
262 if let Some(other_bool) = other.as_any().downcast_ref::<FloatValue>() {

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_floatMethod · 0.80
is_floatMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected