Skip to content

Commit 0b2cdca

Browse files
committed
init
1 parent eb3fe70 commit 0b2cdca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/value_converter.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ impl ToSql for PythonDTO {
176176
PythonDTO::PyDateTimeTz(pydatetime_tz) => {
177177
<&DateTime<FixedOffset> as ToSql>::to_sql(&pydatetime_tz, ty, out)?;
178178
}
179-
PythonDTO::PyIpAddress(_pyidaddress) => {}
179+
PythonDTO::PyIpAddress(pyidaddress) => {
180+
<&IpAddr as ToSql>::to_sql(&pyidaddress, ty, out)?;
181+
}
180182
PythonDTO::PyList(py_iterable) | PythonDTO::PyTuple(py_iterable) => {
181183
let mut items = Vec::new();
182184
for inner in py_iterable {
@@ -345,6 +347,10 @@ pub fn py_to_rust(parameter: &PyAny) -> RustPSQLDriverPyResult<PythonDTO> {
345347
));
346348
}
347349

350+
if let Ok(id_address) = parameter.extract::<IpAddr>() {
351+
return Ok(PythonDTO::PyIpAddress(id_address));
352+
}
353+
348354
Err(RustPSQLDriverError::PyToRustValueConversionError(format!(
349355
"Can not covert you type {parameter} into inner one",
350356
)))

0 commit comments

Comments
 (0)