Skip to content

Commit 867b002

Browse files
committed
Add interval to supported types
1 parent 06c128f commit 867b002

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

crates/gitql-core/src/types_table.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use gitql_ast::types::date::DateType;
55
use gitql_ast::types::datetime::DateTimeType;
66
use gitql_ast::types::float::FloatType;
77
use gitql_ast::types::integer::IntType;
8+
use gitql_ast::types::interval::IntervalType;
89
use gitql_ast::types::text::TextType;
910
use gitql_ast::types::time::TimeType;
1011
use gitql_ast::types::DataType;
@@ -78,6 +79,7 @@ fn register_primitives_types(types_map: &mut HashMap<&'static str, Box<dyn DataT
7879
types_map.insert("date", Box::new(DateType));
7980
types_map.insert("time", Box::new(TimeType));
8081
types_map.insert("datetime", Box::new(DateTimeType));
82+
types_map.insert("interval", Box::new(IntervalType));
8183

8284
// SQL Type Aliases
8385
types_map.insert("int", Box::new(IntType));

crates/gitql-parser/src/parse_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ fn parse_primitive_type(
6262
let type_name_token = consume_conditional_token_or_errors(
6363
tokens,
6464
position,
65-
|token| matches!(token.kind, TokenKind::Symbol(_)),
65+
|token| matches!(token.kind, TokenKind::Symbol(_) | TokenKind::Interval),
6666
"Expect Symbol to represent Type name",
6767
)?;
6868

69-
let type_literal = type_name_token.to_string();
69+
let type_literal = type_name_token.to_string().to_lowercase();
7070
if let Some(data_type) = env.types_table.lookup(type_literal.as_str()) {
7171
return Ok(data_type);
7272
}

0 commit comments

Comments
 (0)