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

Method group_gte_op

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

Source from the content-addressed store, hash-verified

169 }
170
171 fn group_gte_op(
172 &self,
173 other: &Box<dyn Value>,
174 group_op: &GroupComparisonOperator,
175 ) -> Result<Box<dyn Value>, String> {
176 if other.is_array_of(|element_type| element_type.is_text()) {
177 let elements = &other.as_array().unwrap();
178 let mut matches_count = 0;
179 for element in elements.iter() {
180 if self.value >= element.as_text().unwrap() {
181 matches_count += 1;
182 if GroupComparisonOperator::Any.eq(group_op) {
183 break;
184 }
185 }
186 }
187
188 let result = match group_op {
189 GroupComparisonOperator::All => matches_count == elements.len(),
190 GroupComparisonOperator::Any => matches_count > 0,
191 };
192
193 return Ok(Box::new(BoolValue::new(result)));
194 }
195 Err("Unexpected type to perform `>=` with".to_string())
196 }
197
198 fn lt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
199 if let Some(other_text) = other.as_any().downcast_ref::<TextValue>() {

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_textMethod · 0.80
is_textMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected