diff --git a/src/entity/prelude.rs b/src/entity/prelude.rs index 25ae5f67..c7182287 100644 --- a/src/entity/prelude.rs +++ b/src/entity/prelude.rs @@ -12,6 +12,9 @@ pub use serde_json::Value as Json; #[cfg(feature = "with-chrono")] pub use chrono::NaiveDateTime as DateTime; +#[cfg(feature = "with-chrono")] +pub type DateTimeWithTimeZone = chrono::DateTime; + #[cfg(feature = "with-rust_decimal")] pub use rust_decimal::Decimal; diff --git a/src/executor/query.rs b/src/executor/query.rs index b58c5a2c..99ebaba6 100644 --- a/src/executor/query.rs +++ b/src/executor/query.rs @@ -1,6 +1,4 @@ use crate::{debug_print, DbErr}; -use chrono::NaiveDateTime; -use serde_json::Value as Json; use std::fmt; #[derive(Debug)] @@ -219,7 +217,7 @@ macro_rules! try_getable_mysql { } #[cfg(feature = "sqlx-postgres")] QueryResultRow::SqlxPostgres(_) => { - panic!("{} unsupported by sqlx-sqlite", stringify!($type)) + panic!("{} unsupported by sqlx-postgres", stringify!($type)) } #[cfg(feature = "sqlx-sqlite")] QueryResultRow::SqlxSqlite(_) => { @@ -251,14 +249,15 @@ try_getable_mysql!(u64); try_getable_all!(f32); try_getable_all!(f64); try_getable_all!(String); -try_getable_all!(NaiveDateTime); -try_getable_all!(Json); -#[cfg(feature = "with-uuid")] -use uuid::Uuid; +#[cfg(feature = "with-json")] +try_getable_all!(serde_json::Value); -#[cfg(feature = "with-uuid")] -try_getable_all!(Uuid); +#[cfg(feature = "with-chrono")] +try_getable_all!(chrono::NaiveDateTime); + +// #[cfg(feature = "with-chrono")] +// try_getable_all!(chrono::DateTime); #[cfg(feature = "with-rust_decimal")] use rust_decimal::Decimal; @@ -345,3 +344,6 @@ impl TryGetable for Option { } } } + +#[cfg(feature = "with-uuid")] +try_getable_all!(uuid::Uuid); \ No newline at end of file