Skip to content

Commit

Permalink
Revert "PgHasArrayType for transparent types fix. (#2086)"
Browse files Browse the repository at this point in the history
This reverts commit 34e2a17.
  • Loading branch information
abonander authored Sep 6, 2022
1 parent 34e2a17 commit b7c1b8e
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions sqlx-macros/src/derives/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn expand_derive_has_sql_type_transparent(
.push(parse_quote!(#ty: ::sqlx::postgres::PgHasArrayType));
let (array_impl_generics, _, array_where_clause) = array_generics.split_for_impl();

let mut tokens = quote!(
return Ok(quote!(
#[automatically_derived]
impl #impl_generics ::sqlx::Type< DB > for #ident #ty_generics #where_clause {
fn type_info() -> DB::TypeInfo {
Expand All @@ -88,21 +88,15 @@ fn expand_derive_has_sql_type_transparent(
<#ty as ::sqlx::Type<DB>>::compatible(ty)
}
}
);

if cfg!(feature = "postgres") {
tokens.extend(quote!(
#[automatically_derived]
impl #array_impl_generics ::sqlx::postgres::PgHasArrayType for #ident #ty_generics
#array_where_clause {
fn array_type_info() -> ::sqlx::postgres::PgTypeInfo {
<#ty as ::sqlx::postgres::PgHasArrayType>::array_type_info()
}
#[automatically_derived]
#[cfg(feature = "postgres")]
impl #array_impl_generics ::sqlx::postgres::PgHasArrayType for #ident #ty_generics
#array_where_clause {
fn array_type_info() -> ::sqlx::postgres::PgTypeInfo {
<#ty as ::sqlx::postgres::PgHasArrayType>::array_type_info()
}
));
}

return Ok(tokens);
}
));
}

let mut tts = TokenStream::new();
Expand Down

0 comments on commit b7c1b8e

Please sign in to comment.