File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ fn expand_derive_has_sql_type_strong_enum(
135
135
}
136
136
137
137
fn compatible( ty: & sqlx:: mysql:: MySqlTypeInfo ) -> bool {
138
- ty == sqlx:: mysql:: MySqlTypeInfo :: __enum( )
138
+ * ty == sqlx:: mysql:: MySqlTypeInfo :: __enum( )
139
139
}
140
140
}
141
141
) ) ;
Original file line number Diff line number Diff line change @@ -124,6 +124,14 @@ async fn test_column_override_nullable() -> anyhow::Result<()> {
124
124
#[ sqlx( transparent) ]
125
125
struct MyInt4 ( i32 ) ;
126
126
127
+ #[ derive( PartialEq , Eq , Debug , sqlx:: Type ) ]
128
+ #[ sqlx( rename_all = "lowercase" ) ]
129
+ enum MyEnum {
130
+ Red ,
131
+ Green ,
132
+ Blue ,
133
+ }
134
+
127
135
#[ sqlx_macros:: test]
128
136
async fn test_column_override_wildcard ( ) -> anyhow:: Result < ( ) > {
129
137
struct Record {
@@ -154,4 +162,17 @@ async fn test_column_override_exact() -> anyhow::Result<()> {
154
162
Ok ( ( ) )
155
163
}
156
164
165
+ #[ sqlx_macros:: test]
166
+ async fn test_column_override_exact_enum ( ) -> anyhow:: Result < ( ) > {
167
+ let mut conn = new :: < MySql > ( ) . await ?;
168
+
169
+ let record = sqlx:: query!( "select * from (select 'red' as `color: MyEnum`) records" )
170
+ . fetch_one ( & mut conn)
171
+ . await ?;
172
+
173
+ assert_eq ! ( record. color, MyEnum :: Red ) ;
174
+
175
+ Ok ( ( ) )
176
+ }
177
+
157
178
// we don't emit bind parameter typechecks for MySQL so testing the overrides is redundant
You can’t perform that action at this time.
0 commit comments