When I name the type of a field in sqlite as date, and tried to use sqlx::query_as! to parse that field to a struct with chrono::NaiveDate type, I went ok with no problems.
It went wrong when defining the type of a field as time, and tried to parse that to chrono::NaiveTime, the error is that unsupported type TIME of column #2 ("start_time").
Minimal Reproduction
#[derive(Debug)]
pub struct Time {
pub time_id: i64,
pub start_time: NaiveTime,
pub end_time: NaiveTime,
pub persons: i64,
}
let times: Vec<Time> = sqlx::query_as!(Time, r#"
SELECT
time_id,
start_time,
end_time,
persons
FROM times
"#)
.fetch_all(&self.pool)
.await?;
Bug Description
When I name the type of a field in sqlite as
date
, and tried to usesqlx::query_as!
to parse that field to a struct withchrono::NaiveDate
type, I went ok with no problems.It went wrong when defining the type of a field as
time
, and tried to parse that tochrono::NaiveTime
, the error is thatunsupported type TIME of column #2 ("start_time")
.Minimal Reproduction