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

Method group_gt_op

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

Source from the content-addressed store, hash-verified

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