Skip to content

Commit 905df7e

Browse files
authored
add array support for NonZeroI* in postgres (#3303)
* add array support for NonZeroI* in postgres * run rustfmt
1 parent 3396ed0 commit 905df7e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sqlx-postgres/src/types/int.rs

+19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use byteorder::{BigEndian, ByteOrder};
2+
use std::num::{NonZeroI16, NonZeroI32, NonZeroI64};
23

34
use crate::decode::Decode;
45
use crate::encode::{Encode, IsNull};
@@ -153,3 +154,21 @@ impl Decode<'_, Postgres> for i64 {
153154
int_decode(value)
154155
}
155156
}
157+
158+
impl PgHasArrayType for NonZeroI16 {
159+
fn array_type_info() -> PgTypeInfo {
160+
PgTypeInfo::INT2_ARRAY
161+
}
162+
}
163+
164+
impl PgHasArrayType for NonZeroI32 {
165+
fn array_type_info() -> PgTypeInfo {
166+
PgTypeInfo::INT4_ARRAY
167+
}
168+
}
169+
170+
impl PgHasArrayType for NonZeroI64 {
171+
fn array_type_info() -> PgTypeInfo {
172+
PgTypeInfo::INT8_ARRAY
173+
}
174+
}

0 commit comments

Comments
 (0)