diff --git a/lib/src/sql/kind.rs b/lib/src/sql/kind.rs
index 628a4ad7..56ce3909 100644
--- a/lib/src/sql/kind.rs
+++ b/lib/src/sql/kind.rs
@@ -14,11 +14,15 @@ pub enum Kind {
Array,
Bool,
Datetime,
+ Decimal,
+ Duration,
+ Float,
+ Int,
Number,
Object,
String,
- Geometry(String),
Record(Vec
),
+ Geometry(Vec),
}
impl Default for Kind {
@@ -34,14 +38,22 @@ impl fmt::Display for Kind {
Kind::Array => write!(f, "array"),
Kind::Bool => write!(f, "bool"),
Kind::Datetime => write!(f, "datetime"),
+ Kind::Decimal => write!(f, "decimal"),
+ Kind::Duration => write!(f, "duration"),
+ Kind::Float => write!(f, "float"),
+ Kind::Int => write!(f, "int"),
Kind::Number => write!(f, "number"),
Kind::Object => write!(f, "object"),
Kind::String => write!(f, "string"),
- Kind::Geometry(v) => write!(f, "geometry({})", v),
Kind::Record(v) => write!(
f,
"record({})",
- v.iter().map(|ref v| format!("{}", v)).collect::>().join(", ")
+ v.iter().map(|ref v| v.to_string()).collect::>().join(", ")
+ ),
+ Kind::Geometry(v) => write!(
+ f,
+ "geometry({})",
+ v.iter().map(|ref v| v.to_string()).collect::>().join(", ")
),
}
}
@@ -53,6 +65,10 @@ pub fn kind(i: &str) -> IResult<&str, Kind> {
map(tag("array"), |_| Kind::Array),
map(tag("bool"), |_| Kind::Bool),
map(tag("datetime"), |_| Kind::Datetime),
+ map(tag("decimal"), |_| Kind::Decimal),
+ map(tag("duration"), |_| Kind::Duration),
+ map(tag("float"), |_| Kind::Float),
+ map(tag("int"), |_| Kind::Int),
map(tag("number"), |_| Kind::Number),
map(tag("object"), |_| Kind::Object),
map(tag("string"), |_| Kind::String),
@@ -61,23 +77,6 @@ pub fn kind(i: &str) -> IResult<&str, Kind> {
))(i)
}
-fn geometry(i: &str) -> IResult<&str, String> {
- let (i, _) = tag("geometry")(i)?;
- let (i, _) = char('(')(i)?;
- let (i, v) = alt((
- tag("feature"),
- tag("point"),
- tag("line"),
- tag("polygon"),
- tag("multipoint"),
- tag("multiline"),
- tag("multipolygon"),
- tag("collection"),
- ))(i)?;
- let (i, _) = char(')')(i)?;
- Ok((i, String::from(v)))
-}
-
fn record(i: &str) -> IResult<&str, Vec> {
let (i, _) = tag("record")(i)?;
let (i, _) = char('(')(i)?;
@@ -85,3 +84,23 @@ fn record(i: &str) -> IResult<&str, Vec> {
let (i, _) = char(')')(i)?;
Ok((i, v))
}
+
+fn geometry(i: &str) -> IResult<&str, Vec> {
+ let (i, _) = tag("geometry")(i)?;
+ let (i, _) = char('(')(i)?;
+ let (i, v) = many1(map(
+ alt((
+ tag("feature"),
+ tag("point"),
+ tag("line"),
+ tag("polygon"),
+ tag("multipoint"),
+ tag("multiline"),
+ tag("multipolygon"),
+ tag("collection"),
+ )),
+ String::from,
+ ))(i)?;
+ let (i, _) = char(')')(i)?;
+ Ok((i, v))
+}