Adding derivation of any types for chrono types present in all of the featured sql types at compile time

This commit is contained in:
Nathan Roach 2021-02-25 18:40:57 -05:00 committed by Ryan Leckey
parent e8f4eebdbe
commit 9d6c5defd4

View file

@ -55,3 +55,100 @@ impl_any_decode!(f64);
impl_any_decode!(&'r str);
impl_any_decode!(String);
// Conversions for Time SQL types
// Type
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_type!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_type!(chrono::DateTime<chrono::offset::Utc>);
#[cfg(all(
feature = "chrono",
any( feature = "sqlite", feature = "postgres"),
not(any(feature = "mysql", feature = "mssql"))
))]
impl_any_type!(chrono::DateTime<chrono::offset::Local>);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_type!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_type!(chrono::NaiveTime);
// Encode
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_encode!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_encode!(chrono::DateTime<chrono::offset::Utc>);
#[cfg(all(
feature = "chrono",
any( feature = "sqlite", feature = "postgres"),
not(any(feature = "mysql", feature = "mssql"))
))]
impl_any_encode!(chrono::DateTime<chrono::offset::Local>);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_encode!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_encode!(chrono::NaiveTime);
// Decode
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_decode!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "sqlite", feature = "postgres"),
not(feature = "mssql")
))]
impl_any_decode!(chrono::DateTime<chrono::offset::Utc>);
#[cfg(all(
feature = "chrono",
any( feature = "sqlite", feature = "postgres"),
not(any(feature = "mysql", feature = "mssql"))
))]
impl_any_decode!(chrono::DateTime<chrono::offset::Local>);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_decode!(chrono::NaiveDate);
#[cfg(all(
feature = "chrono",
any(feature = "mysql", feature = "postgres"),
not(any(feature = "mssql", feature = "sqlite"))
))]
impl_any_decode!(chrono::NaiveTime);