@@ -71,6 +71,7 @@ impl PythonDTO {
71
71
PythonDTO :: PyIntI64 ( _) => Ok ( tokio_postgres:: types:: Type :: INT8_ARRAY ) ,
72
72
PythonDTO :: PyFloat32 ( _) => Ok ( tokio_postgres:: types:: Type :: FLOAT4_ARRAY ) ,
73
73
PythonDTO :: PyFloat64 ( _) => Ok ( tokio_postgres:: types:: Type :: FLOAT8_ARRAY ) ,
74
+ PythonDTO :: PyIpAddress ( _) => Ok ( tokio_postgres:: types:: Type :: INET_ARRAY ) ,
74
75
PythonDTO :: PyJson ( _) => Ok ( tokio_postgres:: types:: Type :: JSONB_ARRAY ) ,
75
76
_ => Err ( RustPSQLDriverError :: PyToRustValueConversionError (
76
77
"Can't process array type, your type doesn't have support yet" . into ( ) ,
@@ -416,6 +417,8 @@ pub fn postgres_to_py(
416
417
None => Ok ( py. None ( ) ) ,
417
418
}
418
419
}
420
+ // ---------- IpAddress Types ----------
421
+ Type :: INET => Ok ( row. try_get :: < _ , Option < IpAddr > > ( column_i) ?. to_object ( py) ) ,
419
422
// ---------- Array Text Types ----------
420
423
// Convert ARRAY of TEXT or VARCHAR into Vec<String>, then into list[str]
421
424
Type :: TEXT_ARRAY | Type :: VARCHAR_ARRAY => Ok ( row
@@ -462,6 +465,10 @@ pub fn postgres_to_py(
462
465
}
463
466
None => Ok ( py. None ( ) . to_object ( py) ) ,
464
467
} ,
468
+ // Convert ARRAY of INET into Vec<INET>, then into list[IPv4Address | IPv6Address]
469
+ Type :: INET_ARRAY => Ok ( row
470
+ . try_get :: < _ , Option < Vec < IpAddr > > > ( column_i) ?
471
+ . to_object ( py) ) ,
465
472
Type :: JSONB | Type :: JSON => {
466
473
let db_json = row. try_get :: < _ , Option < Value > > ( column_i) ?;
467
474
0 commit comments