mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-14 16:30:16 +00:00
make #[derive(sqlx::Type)] automatically generate impl PgHasArrayType by default for newtype structs (#4008)
add regression tests
This commit is contained in:
committed by
GitHub
parent
e6e8fc7219
commit
3abb186324
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user