Skip to content

Commit

Permalink
Implement PgHasArrayType for all references (#2869)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhawkes authored Mar 14, 2024
1 parent 0d0dddf commit b607251
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 13 additions & 0 deletions sqlx-postgres/src/types/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ pub trait PgHasArrayType {
}
}

impl<T> PgHasArrayType for &T
where
T: PgHasArrayType,
{
fn array_type_info() -> PgTypeInfo {
T::array_type_info()
}

fn array_compatible(ty: &PgTypeInfo) -> bool {
T::array_compatible(ty)
}
}

impl<T> PgHasArrayType for Option<T>
where
T: PgHasArrayType,
Expand Down
6 changes: 0 additions & 6 deletions sqlx-postgres/src/types/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ impl PgHasArrayType for &'_ [u8] {
}
}

impl<const N: usize> PgHasArrayType for &'_ [u8; N] {
fn array_type_info() -> PgTypeInfo {
PgTypeInfo::BYTEA_ARRAY
}
}

impl PgHasArrayType for Box<[u8]> {
fn array_type_info() -> PgTypeInfo {
<[&[u8]] as Type<Postgres>>::type_info()
Expand Down

0 comments on commit b607251

Please sign in to comment.