@@ -189,6 +189,22 @@ macro_rules! impl_type_checking {
189
189
) -> Result <& ' static str , $crate:: type_checking:: Error > {
190
190
use $crate:: config:: macros:: { DateTimeCrate , NumericCrate } ;
191
191
use $crate:: type_checking:: Error ;
192
+
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
+ ) *
192
208
193
209
// Check `macros.preferred-crates.date-time`
194
210
//
@@ -304,32 +320,32 @@ macro_rules! impl_type_checking {
304
320
return Err ( Error :: NumericCrateFeatureNotEnabled ) ;
305
321
}
306
322
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
308
334
// ---------------------
309
335
$(
310
336
$( #[ $meta] ) ?
311
337
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) ) ;
313
339
}
314
340
) *
315
341
316
342
$(
317
343
$( #[ $meta] ) ?
318
344
if <$ty as sqlx_core:: types:: Type <$database>>:: compatible( info) {
319
- return Ok ( $crate :: select_input_type !( $ty $ ( , $input ) ? ) ) ;
345
+ return Ok ( stringify !( $ty) ) ;
320
346
}
321
347
) *
322
-
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
-
348
+
333
349
// Check `macros.preferred-crates.date-time`
334
350
//
335
351
// Due to legacy reasons, `time` takes precedent over `chrono` if both are enabled.
@@ -444,22 +460,6 @@ macro_rules! impl_type_checking {
444
460
return Err ( Error :: NumericCrateFeatureNotEnabled ) ;
445
461
}
446
462
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
-
463
463
Err ( Error :: NoMappingFound )
464
464
}
465
465
0 commit comments