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

Method group_gt_op

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

Source from the content-addressed store, hash-verified

125 }
126
127 fn group_gt_op(
128 &self,
129 other: &Box<dyn Value>,
130 group_op: &GroupComparisonOperator,
131 ) -> Result<Box<dyn Value>, String> {
132 if other.is_array_of(|element_type| element_type.is_time()) {
133 let elements = &other.as_array().unwrap();
134 let mut matches_count = 0;
135 for element in elements.iter() {
136 if self.value > element.as_time().unwrap() {
137 matches_count += 1;
138 if GroupComparisonOperator::Any.eq(group_op) {
139 break;
140 }
141 }
142 }
143
144 let result = match group_op {
145 GroupComparisonOperator::All => matches_count == elements.len(),
146 GroupComparisonOperator::Any => matches_count > 0,
147 };
148
149 return Ok(Box::new(BoolValue::new(result)));
150 }
151 Err("Unexpected type to perform `>` with".to_string())
152 }
153
154 fn gte_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
155 if let Some(other_text) = other.as_any().downcast_ref::<TimeValue>() {

Callers

nothing calls this directly

Calls 6

is_array_ofMethod · 0.80
as_arrayMethod · 0.80
as_timeMethod · 0.80
is_timeMethod · 0.45
eqMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected