From 7d5dc66555fb0b0a66f5ee254da5c0cd1d004524 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 22 Feb 2022 19:08:22 +0000 Subject: [PATCH] Ensure we parse datetimes and durations in JSON requests --- lib/src/sql/value/value.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 5e2d9e6e..a0ee50c9 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -4,8 +4,8 @@ use crate::dbs::Transaction; use crate::err::Error; use crate::sql::array::{array, Array}; use crate::sql::common::commas; -use crate::sql::datetime::{datetime, datetime_raw, Datetime}; -use crate::sql::duration::{duration, duration_raw, Duration}; +use crate::sql::datetime::{datetime, Datetime}; +use crate::sql::duration::{duration, Duration}; use crate::sql::error::IResult; use crate::sql::expression::{expression, Expression}; use crate::sql::function::{function, Function}; @@ -1001,6 +1001,8 @@ pub fn json(i: &str) -> IResult<&str, Value> { map(tag_no_case("NULL"), |_| Value::Null), map(tag_no_case("true"), |_| Value::True), map(tag_no_case("false"), |_| Value::False), + map(datetime, |v| Value::Datetime(v)), + map(duration, |v| Value::Duration(v)), map(geometry, |v| Value::Geometry(v)), map(number, |v| Value::Number(v)), map(object, |v| Value::Object(v)),