Skip to content

Commit b607251

Browse files
authored
Implement PgHasArrayType for all references (#2869)
1 parent 0d0dddf commit b607251

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

sqlx-postgres/src/types/array.rs

+13
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ pub trait PgHasArrayType {
5555
}
5656
}
5757

58+
impl<T> PgHasArrayType for &T
59+
where
60+
T: PgHasArrayType,
61+
{
62+
fn array_type_info() -> PgTypeInfo {
63+
T::array_type_info()
64+
}
65+
66+
fn array_compatible(ty: &PgTypeInfo) -> bool {
67+
T::array_compatible(ty)
68+
}
69+
}
70+
5871
impl<T> PgHasArrayType for Option<T>
5972
where
6073
T: PgHasArrayType,

sqlx-postgres/src/types/bytes.rs

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ impl PgHasArrayType for &'_ [u8] {
1616
}
1717
}
1818

19-
impl<const N: usize> PgHasArrayType for &'_ [u8; N] {
20-
fn array_type_info() -> PgTypeInfo {
21-
PgTypeInfo::BYTEA_ARRAY
22-
}
23-
}
24-
2519
impl PgHasArrayType for Box<[u8]> {
2620
fn array_type_info() -> PgTypeInfo {
2721
<[&[u8]] as Type<Postgres>>::type_info()

0 commit comments

Comments
 (0)