make #[derive(sqlx::Type)] automatically generate impl PgHasArrayType by default for newtype structs (#4008)

add regression tests
This commit is contained in:
Jonatan Czarniecki
2025-08-28 03:12:20 +02:00
committed by GitHub
parent e6e8fc7219
commit 3abb186324
2 changed files with 36 additions and 1 deletions

View File

@@ -124,6 +124,17 @@ fn expand_derive_has_sql_type_transparent(
}
}
));
if !attr.no_pg_array {
tts.extend(quote!(
#[automatically_derived]
impl ::sqlx::postgres::PgHasArrayType for #ident #ty_generics {
fn array_type_info() -> ::sqlx::postgres::PgTypeInfo {
::sqlx::postgres::PgTypeInfo::array_of(#ty_name)
}
}
));
}
}
Ok(tts)