gitql_core/values/
null.rs

1use std::any::Any;
2use std::cmp::Ordering;
3
4use gitql_ast::types::null::NullType;
5use gitql_ast::types::DataType;
6
7use super::base::Value;
8
9#[derive(Clone)]
10pub struct NullValue;
11
12impl Value for NullValue {
13    fn literal(&self) -> String {
14        "Null".to_string()
15    }
16
17    fn equals(&self, other: &Box<dyn Value>) -> bool {
18        other.as_any().downcast_ref::<NullValue>().is_some()
19    }
20
21    fn compare(&self, _other: &Box<dyn Value>) -> Option<Ordering> {
22        None
23    }
24
25    fn data_type(&self) -> Box<dyn DataType> {
26        Box::new(NullType)
27    }
28
29    fn as_any(&self) -> &dyn Any {
30        self
31    }
32}