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

Method group_lt_op

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

Source from the content-addressed store, hash-verified

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