mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
Adding derivation of any types for chrono types present in all of the featured sql types at compile time
This commit is contained in:
parent
e8f4eebdbe
commit
9d6c5defd4
1 changed files with 97 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue