DateTimeWithTimeZone

This commit is contained in:
Chris Tsang 2021-08-09 17:13:48 +08:00
parent 75cbbd9b40
commit 4731f1fd5e
2 changed files with 14 additions and 9 deletions

View File

@ -12,6 +12,9 @@ pub use serde_json::Value as Json;
#[cfg(feature = "with-chrono")] #[cfg(feature = "with-chrono")]
pub use chrono::NaiveDateTime as DateTime; pub use chrono::NaiveDateTime as DateTime;
#[cfg(feature = "with-chrono")]
pub type DateTimeWithTimeZone = chrono::DateTime<chrono::FixedOffset>;
#[cfg(feature = "with-rust_decimal")] #[cfg(feature = "with-rust_decimal")]
pub use rust_decimal::Decimal; pub use rust_decimal::Decimal;

View File

@ -1,6 +1,4 @@
use crate::{debug_print, DbErr}; use crate::{debug_print, DbErr};
use chrono::NaiveDateTime;
use serde_json::Value as Json;
use std::fmt; use std::fmt;
#[derive(Debug)] #[derive(Debug)]
@ -219,7 +217,7 @@ macro_rules! try_getable_mysql {
} }
#[cfg(feature = "sqlx-postgres")] #[cfg(feature = "sqlx-postgres")]
QueryResultRow::SqlxPostgres(_) => { QueryResultRow::SqlxPostgres(_) => {
panic!("{} unsupported by sqlx-sqlite", stringify!($type)) panic!("{} unsupported by sqlx-postgres", stringify!($type))
} }
#[cfg(feature = "sqlx-sqlite")] #[cfg(feature = "sqlx-sqlite")]
QueryResultRow::SqlxSqlite(_) => { QueryResultRow::SqlxSqlite(_) => {
@ -251,14 +249,15 @@ try_getable_mysql!(u64);
try_getable_all!(f32); try_getable_all!(f32);
try_getable_all!(f64); try_getable_all!(f64);
try_getable_all!(String); try_getable_all!(String);
try_getable_all!(NaiveDateTime);
try_getable_all!(Json);
#[cfg(feature = "with-uuid")] #[cfg(feature = "with-json")]
use uuid::Uuid; try_getable_all!(serde_json::Value);
#[cfg(feature = "with-uuid")] #[cfg(feature = "with-chrono")]
try_getable_all!(Uuid); try_getable_all!(chrono::NaiveDateTime);
// #[cfg(feature = "with-chrono")]
// try_getable_all!(chrono::DateTime<chrono::FixedOffset>);
#[cfg(feature = "with-rust_decimal")] #[cfg(feature = "with-rust_decimal")]
use rust_decimal::Decimal; use rust_decimal::Decimal;
@ -345,3 +344,6 @@ impl TryGetable for Option<Decimal> {
} }
} }
} }
#[cfg(feature = "with-uuid")]
try_getable_all!(uuid::Uuid);