File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff 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 ) ) )
You can’t perform that action at this time.
0 commit comments