diff --git a/sqlx-core/src/any/types.rs b/sqlx-core/src/any/types.rs index 26eeb889..a26173ce 100644 --- a/sqlx-core/src/any/types.rs +++ b/sqlx-core/src/any/types.rs @@ -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); +#[cfg(all( + feature = "chrono", + any( feature = "sqlite", feature = "postgres"), + not(any(feature = "mysql", feature = "mssql")) +))] +impl_any_type!(chrono::DateTime); +#[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); +#[cfg(all( + feature = "chrono", + any( feature = "sqlite", feature = "postgres"), + not(any(feature = "mysql", feature = "mssql")) +))] +impl_any_encode!(chrono::DateTime); +#[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); +#[cfg(all( + feature = "chrono", + any( feature = "sqlite", feature = "postgres"), + not(any(feature = "mysql", feature = "mssql")) +))] +impl_any_decode!(chrono::DateTime); +#[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);