mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-10 07:39:56 +00:00
fix: restore original type-checking order
This commit is contained in:
parent
52bb9d0f21
commit
80abc5b166
@ -190,6 +190,22 @@ macro_rules! impl_type_checking {
|
||||
use $crate::config::macros::{DateTimeCrate, NumericCrate};
|
||||
use $crate::type_checking::Error;
|
||||
|
||||
// Check non-special types
|
||||
// ---------------------
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::type_info() == *info {
|
||||
return Ok($crate::select_input_type!($ty $(, $input)?));
|
||||
}
|
||||
)*
|
||||
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::compatible(info) {
|
||||
return Ok($crate::select_input_type!($ty $(, $input)?));
|
||||
}
|
||||
)*
|
||||
|
||||
// Check `macros.preferred-crates.date-time`
|
||||
//
|
||||
// Due to legacy reasons, `time` takes precedent over `chrono` if both are enabled.
|
||||
@ -304,22 +320,6 @@ macro_rules! impl_type_checking {
|
||||
return Err(Error::NumericCrateFeatureNotEnabled);
|
||||
}
|
||||
|
||||
// Check all other types
|
||||
// ---------------------
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::type_info() == *info {
|
||||
return Ok($crate::select_input_type!($ty $(, $input)?));
|
||||
}
|
||||
)*
|
||||
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::compatible(info) {
|
||||
return Ok($crate::select_input_type!($ty $(, $input)?));
|
||||
}
|
||||
)*
|
||||
|
||||
Err(Error::NoMappingFound)
|
||||
}
|
||||
|
||||
@ -330,6 +330,22 @@ macro_rules! impl_type_checking {
|
||||
use $crate::config::macros::{DateTimeCrate, NumericCrate};
|
||||
use $crate::type_checking::Error;
|
||||
|
||||
// Check non-special types
|
||||
// ---------------------
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::type_info() == *info {
|
||||
return Ok(stringify!($ty));
|
||||
}
|
||||
)*
|
||||
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::compatible(info) {
|
||||
return Ok(stringify!($ty));
|
||||
}
|
||||
)*
|
||||
|
||||
// Check `macros.preferred-crates.date-time`
|
||||
//
|
||||
// Due to legacy reasons, `time` takes precedent over `chrono` if both are enabled.
|
||||
@ -444,22 +460,6 @@ macro_rules! impl_type_checking {
|
||||
return Err(Error::NumericCrateFeatureNotEnabled);
|
||||
}
|
||||
|
||||
// Check all other types
|
||||
// ---------------------
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::type_info() == *info {
|
||||
return Ok(stringify!($ty));
|
||||
}
|
||||
)*
|
||||
|
||||
$(
|
||||
$(#[$meta])?
|
||||
if <$ty as sqlx_core::types::Type<$database>>::compatible(info) {
|
||||
return Ok(stringify!($ty));
|
||||
}
|
||||
)*
|
||||
|
||||
Err(Error::NoMappingFound)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user