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

Method group_eq_op

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

Source from the content-addressed store, hash-verified

60 }
61
62 fn group_eq_op(
63 &self,
64 other: &Box<dyn Value>,
65 group_op: &GroupComparisonOperator,
66 ) -> Result<Box<dyn Value>, String> {
67 if other.is_array_of(|element_type| element_type.is_date_time()) {
68 let elements = &other.as_array().unwrap();
69 let mut matches_count = 0;
70 for element in elements.iter() {
71 if self.value == element.as_date_time().unwrap() {
72 matches_count += 1;
73 if GroupComparisonOperator::Any.eq(group_op) {
74 break;
75 }
76 }
77 }
78
79 let result = match group_op {
80 GroupComparisonOperator::All => matches_count == elements.len(),
81 GroupComparisonOperator::Any => matches_count > 0,
82 };
83
84 return Ok(Box::new(BoolValue::new(result)));
85 }
86 Err("Unexpected type to perform `=` with".to_string())
87 }
88
89 fn bang_eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
90 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