Ensure we parse datetimes and durations in JSON requests

This commit is contained in:
Tobie Morgan Hitchcock 2022-02-22 19:08:22 +00:00
parent d4566ff6ea
commit 7d5dc66555

View file

@ -4,8 +4,8 @@ use crate::dbs::Transaction;
use crate::err::Error; use crate::err::Error;
use crate::sql::array::{array, Array}; use crate::sql::array::{array, Array};
use crate::sql::common::commas; use crate::sql::common::commas;
use crate::sql::datetime::{datetime, datetime_raw, Datetime}; use crate::sql::datetime::{datetime, Datetime};
use crate::sql::duration::{duration, duration_raw, Duration}; use crate::sql::duration::{duration, Duration};
use crate::sql::error::IResult; use crate::sql::error::IResult;
use crate::sql::expression::{expression, Expression}; use crate::sql::expression::{expression, Expression};
use crate::sql::function::{function, Function}; 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("NULL"), |_| Value::Null),
map(tag_no_case("true"), |_| Value::True), map(tag_no_case("true"), |_| Value::True),
map(tag_no_case("false"), |_| Value::False), 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(geometry, |v| Value::Geometry(v)),
map(number, |v| Value::Number(v)), map(number, |v| Value::Number(v)),
map(object, |v| Value::Object(v)), map(object, |v| Value::Object(v)),