Skip to content

Commit d49eba4

Browse files
authored
Merge pull request #131 from psqlpy-python/refactor_value_converter
Refactor value converter
2 parents 66450d5 + 2f15769 commit d49eba4

18 files changed

+2449
-2238
lines changed

src/driver/inner_connection.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ use tokio_postgres::{Client, CopyInSink, Row, Statement, ToStatement};
88
use crate::{
99
exceptions::rust_errors::{RustPSQLDriverError, RustPSQLDriverPyResult},
1010
query_result::{PSQLDriverPyQueryResult, PSQLDriverSinglePyQueryResult},
11-
value_converter::{convert_parameters_and_qs, postgres_to_py, PythonDTO, QueryParameter},
11+
value_converter::{
12+
consts::QueryParameter,
13+
funcs::{from_python::convert_parameters_and_qs, to_python::postgres_to_py},
14+
models::dto::PythonDTO,
15+
},
1216
};
1317

1418
#[allow(clippy::module_name_repetitions)]

src/extra_types.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ use pyo3::{
1010
use serde_json::Value;
1111

1212
use crate::{
13-
additional_types::{Circle as RustCircle, Line as RustLine},
1413
exceptions::rust_errors::{RustPSQLDriverError, RustPSQLDriverPyResult},
1514
value_converter::{
16-
build_flat_geo_coords, build_geo_coords, build_serde_value,
17-
py_sequence_into_postgres_array, PythonDTO,
15+
additional_types::{Circle as RustCircle, Line as RustLine},
16+
funcs::from_python::{
17+
build_flat_geo_coords, build_geo_coords, py_sequence_into_postgres_array,
18+
},
19+
models::{dto::PythonDTO, serde_value::build_serde_value},
1820
},
1921
};
2022

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub mod additional_types;
21
pub mod common;
32
pub mod driver;
43
pub mod exceptions;

src/query_result.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
use pyo3::{prelude::*, pyclass, pymethods, types::PyDict, Py, PyAny, Python, ToPyObject};
22
use tokio_postgres::Row;
33

4-
use crate::{exceptions::rust_errors::RustPSQLDriverPyResult, value_converter::postgres_to_py};
4+
use crate::{
5+
exceptions::rust_errors::RustPSQLDriverPyResult,
6+
value_converter::funcs::to_python::postgres_to_py,
7+
};
58

69
/// Convert postgres `Row` into Python Dict.
710
///

0 commit comments

Comments
 (0)