Skip to content

Commit

Permalink
add array support for NonZeroI* in postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesIBK committed Jun 20, 2024
1 parent 402022d commit 89cd4cf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sqlx-postgres/src/types/int.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::num::{NonZeroI16, NonZeroI32, NonZeroI64};
use byteorder::{BigEndian, ByteOrder};

use crate::decode::Decode;
Expand Down Expand Up @@ -153,3 +154,22 @@ impl Decode<'_, Postgres> for i64 {
int_decode(value)
}
}

impl PgHasArrayType for NonZeroI16 {
fn array_type_info() -> PgTypeInfo {
PgTypeInfo::INT2_ARRAY
}
}

impl PgHasArrayType for NonZeroI32 {
fn array_type_info() -> PgTypeInfo {
PgTypeInfo::INT4_ARRAY
}
}


impl PgHasArrayType for NonZeroI64 {
fn array_type_info() -> PgTypeInfo {
PgTypeInfo::INT8_ARRAY
}
}

0 comments on commit 89cd4cf

Please sign in to comment.