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

Method group_gt_op

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

Source from the content-addressed store, hash-verified

130 }
131
132 fn group_gt_op(
133 &self,
134 other: &Box<dyn Value>,
135 group_op: &GroupComparisonOperator,
136 ) -> Result<Box<dyn Value>, String> {
137 if other.is_array_of(|element_type| element_type.is_date_time()) {
138 let elements = &other.as_array().unwrap();
139 let mut matches_count = 0;
140 for element in elements.iter() {
141 if self.value > element.as_date_time().unwrap() {
142 matches_count += 1;
143 if GroupComparisonOperator::Any.eq(group_op) {
144 break;
145 }
146 }
147 }
148
149 let result = match group_op {
150 GroupComparisonOperator::All => matches_count == elements.len(),
151 GroupComparisonOperator::Any => matches_count > 0,
152 };
153
154 return Ok(Box::new(BoolValue::new(result)));
155 }
156 Err("Unexpected type to perform `>` with".to_string())
157 }
158
159 fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
160 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