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

Method group_gte_op

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

Source from the content-addressed store, hash-verified

197 }
198
199 fn group_gte_op(
200 &self,
201 other: &Box<dyn Value>,
202 group_op: &GroupComparisonOperator,
203 ) -> Result<Box<dyn Value>, String> {
204 if other.is_array_of(|element_type| element_type.is_float()) {
205 let elements = &other.as_array().unwrap();
206 let mut matches_count = 0;
207 for element in elements.iter() {
208 if self.value >= element.as_float().unwrap() {
209 matches_count += 1;
210 if GroupComparisonOperator::Any.eq(group_op) {
211 break;
212 }
213 }
214 }
215
216 let result = match group_op {
217 GroupComparisonOperator::All => matches_count == elements.len(),
218 GroupComparisonOperator::Any => matches_count > 0,
219 };
220
221 return Ok(Box::new(BoolValue::new(result)));
222 }
223 Err("Unexpected type to perform `>=` with".to_string())
224 }
225
226 fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
227 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