Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seanaye committed Jan 10, 2025
1 parent e3175ac commit c382489
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions sqlx-macros-core/src/derives/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ fn expand_derive_from_row_struct(
},
(false, None, Some(JsonAttribute::Nullable)) => {
predicates
.push(parse_quote!(::core::Option<::sqlx::types::Json<#ty>>: ::sqlx::decode::Decode<#lifetime, R::Database>));
predicates.push(parse_quote!(::core::Option<::sqlx::types::Json<#ty>>: ::sqlx::types::Type<R::Database>));
.push(parse_quote!(::core::option::Option<::sqlx::types::Json<#ty>>: ::sqlx::decode::Decode<#lifetime, R::Database>));
predicates.push(parse_quote!(::core::option::Option<::sqlx::types::Json<#ty>>: ::sqlx::types::Type<R::Database>));

parse_quote!(__row.try_get::<::core::Option<::sqlx::types::Json<_>>, _>(#id_s).map(|x| x.flatten().map(|y| y.0)))
parse_quote!(__row.try_get::<::core::option::Option<::sqlx::types::Json<_>>, _>(#id_s).map(|x| x.and_then(|y| y.0)))
},
};

Expand Down
4 changes: 2 additions & 2 deletions tests/mysql/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,11 @@ async fn test_from_row_json_attr_nullable() -> anyhow::Result<()> {

let mut conn = new::<MySql>().await?;

let record = sqlx::query_as::<_, Record>("select null as j")
let record = sqlx::query_as::<_, Record>("select NULL as j")
.fetch_one(&mut conn)
.await?;

assert_eq!(record.j, None);
assert!(record.j.is_none());
Ok(())
}

Expand Down

0 comments on commit c382489

Please sign in to comment.