Skip to content

Commit c382489

Browse files
committed
fix tests
1 parent e3175ac commit c382489

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sqlx-macros-core/src/derives/row.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

tests/mysql/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)