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

Method group_gt_op

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

Source from the content-addressed store, hash-verified

162 }
163
164 fn group_gt_op(
165 &self,
166 other: &Box<dyn Value>,
167 group_op: &GroupComparisonOperator,
168 ) -> Result<Box<dyn Value>, String> {
169 if other.is_array_of(|element_type| element_type.is_float()) {
170 let elements = &other.as_array().unwrap();
171 let mut matches_count = 0;
172 for element in elements.iter() {
173 if self.value > element.as_float().unwrap() {
174 matches_count += 1;
175 if GroupComparisonOperator::Any.eq(group_op) {
176 break;
177 }
178 }
179 }
180
181 let result = match group_op {
182 GroupComparisonOperator::All => matches_count == elements.len(),
183 GroupComparisonOperator::Any => matches_count > 0,
184 };
185
186 return Ok(Box::new(BoolValue::new(result)));
187 }
188 Err("Unexpected type to perform `>` with".to_string())
189 }
190
191 fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
192 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