Skip to content

Commit a8ff934

Browse files
committed
Support != operator between Raw expressions
1 parent ffe3825 commit a8ff934

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

crates/gitql-ast/src/types/row.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,8 @@ impl DataType for RowType {
5959
fn can_perform_eq_op_with(&self) -> Vec<Box<dyn DataType>> {
6060
vec![Box::new(self.clone())]
6161
}
62+
63+
fn can_perform_bang_eq_op_with(&self) -> Vec<Box<dyn DataType>> {
64+
vec![Box::new(self.clone())]
65+
}
6266
}

crates/gitql-core/src/values/row.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,11 @@ impl Value for RowValue {
7171
}
7272
Ok(Box::new(BoolValue::new(self.equals(other))))
7373
}
74+
75+
fn bang_eq_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> {
76+
if other.as_any().downcast_ref::<RowValue>().is_none() {
77+
return Err("Unexpected type to perform `!=` with".to_string());
78+
}
79+
Ok(Box::new(BoolValue::new(!self.equals(other))))
80+
}
7481
}

0 commit comments

Comments
 (0)