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

Method group_lt_op

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_date_timeMethod · 0.80
is_date_timeMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected