@@ -190,6 +190,22 @@ macro_rules! impl_type_checking {
190190 use $crate:: config:: macros:: { DateTimeCrate , NumericCrate } ;
191191 use $crate:: type_checking:: Error ;
192192
193+ // Check non-special types
194+ // ---------------------
195+ $(
196+ $( #[ $meta] ) ?
197+ if <$ty as sqlx_core:: types:: Type <$database>>:: type_info( ) == * info {
198+ return Ok ( $crate:: select_input_type!( $ty $( , $input) ?) ) ;
199+ }
200+ ) *
201+
202+ $(
203+ $( #[ $meta] ) ?
204+ if <$ty as sqlx_core:: types:: Type <$database>>:: compatible( info) {
205+ return Ok ( $crate:: select_input_type!( $ty $( , $input) ?) ) ;
206+ }
207+ ) *
208+
193209 // Check `macros.preferred-crates.date-time`
194210 //
195211 // Due to legacy reasons, `time` takes precedent over `chrono` if both are enabled.
@@ -304,32 +320,32 @@ macro_rules! impl_type_checking {
304320 return Err ( Error :: NumericCrateFeatureNotEnabled ) ;
305321 }
306322
307- // Check all other types
323+ Err ( Error :: NoMappingFound )
324+ }
325+
326+ fn return_type_for_id(
327+ info: & Self :: TypeInfo ,
328+ preferred_crates: & $crate:: config:: macros:: PreferredCrates ,
329+ ) -> Result <& ' static str , $crate:: type_checking:: Error > {
330+ use $crate:: config:: macros:: { DateTimeCrate , NumericCrate } ;
331+ use $crate:: type_checking:: Error ;
332+
333+ // Check non-special types
308334 // ---------------------
309335 $(
310336 $( #[ $meta] ) ?
311337 if <$ty as sqlx_core:: types:: Type <$database>>:: type_info( ) == * info {
312- return Ok ( $crate :: select_input_type !( $ty $ ( , $input ) ? ) ) ;
338+ return Ok ( stringify !( $ty) ) ;
313339 }
314340 ) *
315341
316342 $(
317343 $( #[ $meta] ) ?
318344 if <$ty as sqlx_core:: types:: Type <$database>>:: compatible( info) {
319- return Ok ( $crate :: select_input_type !( $ty $ ( , $input ) ? ) ) ;
345+ return Ok ( stringify !( $ty) ) ;
320346 }
321347 ) *
322348
323- Err ( Error :: NoMappingFound )
324- }
325-
326- fn return_type_for_id(
327- info: & Self :: TypeInfo ,
328- preferred_crates: & $crate:: config:: macros:: PreferredCrates ,
329- ) -> Result <& ' static str , $crate:: type_checking:: Error > {
330- use $crate:: config:: macros:: { DateTimeCrate , NumericCrate } ;
331- use $crate:: type_checking:: Error ;
332-
333349 // Check `macros.preferred-crates.date-time`
334350 //
335351 // Due to legacy reasons, `time` takes precedent over `chrono` if both are enabled.
@@ -444,22 +460,6 @@ macro_rules! impl_type_checking {
444460 return Err ( Error :: NumericCrateFeatureNotEnabled ) ;
445461 }
446462
447- // Check all other types
448- // ---------------------
449- $(
450- $( #[ $meta] ) ?
451- if <$ty as sqlx_core:: types:: Type <$database>>:: type_info( ) == * info {
452- return Ok ( stringify!( $ty) ) ;
453- }
454- ) *
455-
456- $(
457- $( #[ $meta] ) ?
458- if <$ty as sqlx_core:: types:: Type <$database>>:: compatible( info) {
459- return Ok ( stringify!( $ty) ) ;
460- }
461- ) *
462-
463463 Err ( Error :: NoMappingFound )
464464 }
465465
0 commit comments