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 {
176
176
PythonDTO :: PyDateTimeTz ( pydatetime_tz) => {
177
177
<& DateTime < FixedOffset > as ToSql >:: to_sql ( & pydatetime_tz, ty, out) ?;
178
178
}
179
- PythonDTO :: PyIpAddress ( _pyidaddress) => { }
179
+ PythonDTO :: PyIpAddress ( pyidaddress) => {
180
+ <& IpAddr as ToSql >:: to_sql ( & pyidaddress, ty, out) ?;
181
+ }
180
182
PythonDTO :: PyList ( py_iterable) | PythonDTO :: PyTuple ( py_iterable) => {
181
183
let mut items = Vec :: new ( ) ;
182
184
for inner in py_iterable {
@@ -345,6 +347,10 @@ pub fn py_to_rust(parameter: &PyAny) -> RustPSQLDriverPyResult<PythonDTO> {
345
347
) ) ;
346
348
}
347
349
350
+ if let Ok ( id_address) = parameter. extract :: < IpAddr > ( ) {
351
+ return Ok ( PythonDTO :: PyIpAddress ( id_address) ) ;
352
+ }
353
+
348
354
Err ( RustPSQLDriverError :: PyToRustValueConversionError ( format ! (
349
355
"Can not covert you type {parameter} into inner one" ,
350
356
) ) )
You can’t perform that action at this time.
0 commit comments