@@ -7,46 +7,59 @@ pub struct Choice(pub String);
7
7
const _: ( ) = {
8
8
use sqlx:: database:: { Database , HasValueRef } ;
9
9
use sqlx:: error:: BoxDynError ;
10
- use sqlx:: { Decode , MySql , Postgres , Sqlite , Type } ;
11
- impl Type < Postgres > for Choice {
12
- fn type_info ( ) -> <Postgres as Database >:: TypeInfo {
13
- <str as Type < Postgres > >:: type_info ( )
14
- }
15
- fn compatible ( ty : & <Postgres as Database >:: TypeInfo ) -> bool {
16
- <str as Type < Postgres > >:: compatible ( ty)
10
+ use sqlx:: { Decode , Type } ;
11
+
12
+ #[ cfg( feature = "postgres" ) ]
13
+ const _: ( ) = {
14
+ use sqlx:: Postgres ;
15
+ impl Type < Postgres > for Choice {
16
+ fn type_info ( ) -> <Postgres as Database >:: TypeInfo {
17
+ <str as Type < Postgres > >:: type_info ( )
18
+ }
19
+ fn compatible ( ty : & <Postgres as Database >:: TypeInfo ) -> bool {
20
+ <str as Type < Postgres > >:: compatible ( ty)
21
+ }
17
22
}
18
- }
19
- impl < ' r > Decode < ' r , Postgres > for Choice {
20
- fn decode ( value : < Postgres as HasValueRef < ' r > >:: ValueRef ) -> Result < Self , BoxDynError > {
21
- < String as Decode < ' r , Postgres > > :: decode ( value ) . map ( Self )
23
+ impl < ' r > Decode < ' r , Postgres > for Choice {
24
+ fn decode ( value : < Postgres as HasValueRef < ' r > > :: ValueRef ) -> Result < Self , BoxDynError > {
25
+ < String as Decode < ' r , Postgres > >:: decode ( value ) . map ( Self )
26
+ }
22
27
}
23
- }
28
+ } ;
24
29
25
- impl Type < MySql > for Choice {
26
- fn type_info ( ) -> <MySql as Database >:: TypeInfo {
27
- <str as Type < MySql > >:: type_info ( )
30
+ #[ cfg( feature = "mysql" ) ]
31
+ const _: ( ) = {
32
+ use sqlx:: MySql ;
33
+ impl Type < MySql > for Choice {
34
+ fn type_info ( ) -> <MySql as Database >:: TypeInfo {
35
+ <str as Type < MySql > >:: type_info ( )
36
+ }
37
+ fn compatible ( ty : & <MySql as Database >:: TypeInfo ) -> bool {
38
+ <str as Type < MySql > >:: compatible ( ty)
39
+ }
28
40
}
29
- fn compatible ( ty : & <MySql as Database >:: TypeInfo ) -> bool {
30
- <str as Type < MySql > >:: compatible ( ty)
41
+ impl < ' r > Decode < ' r , MySql > for Choice {
42
+ fn decode ( value : <MySql as HasValueRef < ' r > >:: ValueRef ) -> Result < Self , BoxDynError > {
43
+ <String as Decode < ' r , MySql > >:: decode ( value) . map ( Self )
44
+ }
31
45
}
32
- }
33
- impl < ' r > Decode < ' r , MySql > for Choice {
34
- fn decode ( value : <MySql as HasValueRef < ' r > >:: ValueRef ) -> Result < Self , BoxDynError > {
35
- <String as Decode < ' r , MySql > >:: decode ( value) . map ( Self )
36
- }
37
- }
46
+ } ;
38
47
39
- impl Type < Sqlite > for Choice {
40
- fn type_info ( ) -> <Sqlite as Database >:: TypeInfo {
41
- <str as Type < Sqlite > >:: type_info ( )
42
- }
43
- fn compatible ( ty : & <Sqlite as Database >:: TypeInfo ) -> bool {
44
- <str as Type < Sqlite > >:: compatible ( ty)
48
+ #[ cfg( feature = "sqlite" ) ]
49
+ const _: ( ) = {
50
+ use sqlx:: Sqlite ;
51
+ impl Type < Sqlite > for Choice {
52
+ fn type_info ( ) -> <Sqlite as Database >:: TypeInfo {
53
+ <str as Type < Sqlite > >:: type_info ( )
54
+ }
55
+ fn compatible ( ty : & <Sqlite as Database >:: TypeInfo ) -> bool {
56
+ <str as Type < Sqlite > >:: compatible ( ty)
57
+ }
45
58
}
46
- }
47
- impl < ' r > Decode < ' r , Sqlite > for Choice {
48
- fn decode ( value : < Sqlite as HasValueRef < ' r > >:: ValueRef ) -> Result < Self , BoxDynError > {
49
- < String as Decode < ' r , Sqlite > > :: decode ( value ) . map ( Self )
59
+ impl < ' r > Decode < ' r , Sqlite > for Choice {
60
+ fn decode ( value : < Sqlite as HasValueRef < ' r > > :: ValueRef ) -> Result < Self , BoxDynError > {
61
+ < String as Decode < ' r , Sqlite > >:: decode ( value ) . map ( Self )
62
+ }
50
63
}
51
- }
64
+ } ;
52
65
} ;
0 commit comments