mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-28 19:49:23 +00:00
Revert "Derive PgHasArrayType for transparent sqlx types (#1748)"
This reverts commit f5392151
This commit is contained in:
parent
2e026cae67
commit
8a7b554d10
@ -60,8 +60,6 @@ fn expand_derive_has_sql_type_transparent(
|
||||
|
||||
if attr.transparent {
|
||||
let mut generics = generics.clone();
|
||||
let mut array_generics = generics.clone();
|
||||
|
||||
generics
|
||||
.params
|
||||
.insert(0, parse_quote!(DB: ::sqlx::Database));
|
||||
@ -69,13 +67,8 @@ fn expand_derive_has_sql_type_transparent(
|
||||
.make_where_clause()
|
||||
.predicates
|
||||
.push(parse_quote!(#ty: ::sqlx::Type<DB>));
|
||||
let (impl_generics, _, where_clause) = generics.split_for_impl();
|
||||
|
||||
array_generics
|
||||
.make_where_clause()
|
||||
.predicates
|
||||
.push(parse_quote!(#ty: ::sqlx::postgres::PgHasArrayType));
|
||||
let (array_impl_generics, _, array_where_clause) = array_generics.split_for_impl();
|
||||
let (impl_generics, _, where_clause) = generics.split_for_impl();
|
||||
|
||||
return Ok(quote!(
|
||||
#[automatically_derived]
|
||||
@ -88,14 +81,6 @@ fn expand_derive_has_sql_type_transparent(
|
||||
<#ty as ::sqlx::Type<DB>>::compatible(ty)
|
||||
}
|
||||
}
|
||||
#[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()
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -10,20 +10,6 @@ use std::ops::Bound;
|
||||
#[sqlx(transparent)]
|
||||
struct Transparent(i32);
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn test_transparent_slice_to_array() -> anyhow::Result<()> {
|
||||
let mut conn = new::<Postgres>().await?;
|
||||
|
||||
let values = vec![Transparent(1), Transparent(2), Transparent(3)];
|
||||
|
||||
sqlx::query("SELECT 2 = ANY($1);")
|
||||
.bind(&values)
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// "Weak" enums map to an integer type indicated by #[repr]
|
||||
#[derive(PartialEq, Copy, Clone, Debug, sqlx::Type)]
|
||||
#[repr(i32)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user