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

Method group_bang_eq_op

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

Source from the content-addressed store, hash-verified

95 }
96
97 fn group_bang_eq_op(
98 &self,
99 other: &Box<dyn Value>,
100 group_op: &GroupComparisonOperator,
101 ) -> Result<Box<dyn Value>, String> {
102 if other.is_array_of(|element_type| element_type.is_date_time()) {
103 let elements = &other.as_array().unwrap();
104 let mut matches_count = 0;
105 for element in elements.iter() {
106 if self.value != element.as_date_time().unwrap() {
107 matches_count += 1;
108 if GroupComparisonOperator::Any.eq(group_op) {
109 break;
110 }
111 }
112 }
113
114 let result = match group_op {
115 GroupComparisonOperator::All => matches_count == elements.len(),
116 GroupComparisonOperator::Any => matches_count > 0,
117 };
118
119 return Ok(Box::new(BoolValue::new(result)));
120 }
121 Err("Unexpected type to perform `!=` with".to_string())
122 }
123
124 fn gt_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
125 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