File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
sqlx-macros-core/src/derives Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -189,10 +189,10 @@ fn expand_derive_from_row_struct(
189189 } ,
190190 ( false , None , Some ( JsonAttribute :: Nullable ) ) => {
191191 predicates
192- . push ( parse_quote ! ( :: core:: Option <:: sqlx:: types:: Json <#ty>>: :: sqlx:: decode:: Decode <#lifetime, R :: Database >) ) ;
193- predicates. push ( parse_quote ! ( :: core:: Option <:: sqlx:: types:: Json <#ty>>: :: sqlx:: types:: Type <R :: Database >) ) ;
192+ . push ( parse_quote ! ( :: core:: option :: Option <:: sqlx:: types:: Json <#ty>>: :: sqlx:: decode:: Decode <#lifetime, R :: Database >) ) ;
193+ predicates. push ( parse_quote ! ( :: core:: option :: Option <:: sqlx:: types:: Json <#ty>>: :: sqlx:: types:: Type <R :: Database >) ) ;
194194
195- parse_quote ! ( __row. try_get:: <:: core:: Option <:: sqlx:: types:: Json <_>>, _>( #id_s) . map( |x| x. flatten ( ) . map ( |y| y. 0 ) ) )
195+ parse_quote ! ( __row. try_get:: <:: core:: option :: Option <:: sqlx:: types:: Json <_>>, _>( #id_s) . map( |x| x. and_then ( |y| y. 0 ) ) )
196196 } ,
197197 } ;
198198
Original file line number Diff line number Diff line change @@ -510,11 +510,11 @@ async fn test_from_row_json_attr_nullable() -> anyhow::Result<()> {
510510
511511 let mut conn = new :: < MySql > ( ) . await ?;
512512
513- let record = sqlx:: query_as :: < _ , Record > ( "select null as j" )
513+ let record = sqlx:: query_as :: < _ , Record > ( "select NULL as j" )
514514 . fetch_one ( & mut conn)
515515 . await ?;
516516
517- assert_eq ! ( record. j, None ) ;
517+ assert ! ( record. j. is_none ( ) ) ;
518518 Ok ( ( ) )
519519}
520520
You can’t perform that action at this time.
0 commit comments