10000 Fix deriving serde and fix annotated usage · psqlpy-python/psqlpy@c29d400 · GitHub
[go: up one dir, main page]

Skip to content

Commit c29d400

Browse files
author
AGAEV Denis E
committed
Fix deriving serde and fix annotated usage
1 parent 09e5531 commit c29d400

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ byteorder = "1.5.0"
2525
chrono = "0.4.33"
2626
chrono-tz = "0.8.5"
2727
uuid = { version = "1.7.0", features = ["v4"] }
28+
serde = { version = "1.0.205", features = ["derive"] }
2829
serde_json = "1.0.113"
2930
futures-util = "0.3.30"
3031
macaddr = "1.0.1"

python/tests/test_value_converter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
from decimal import Decimal
44
from enum import Enum
55
from ipaddress import IPv4Address
6-
from typing import Annotated, Any, Dict, List, Tuple, Union
6+
from typing import Any, Dict, List, Tuple, Union
77

88
import pytest
99
from pydantic import BaseModel
1010
from tests.conftest import DefaultPydanticModel, DefaultPythonModelClass
11+
from typing_extensions import Annotated
1112

1213
from psqlpy import ConnectionPool
1314
from psqlpy._internal.extra_types import PyCustomType

src/additional_types.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use pyo3::{
1010
types::{PyList, PyTuple},
1111
IntoPy, Py, PyAny, PyObject, Python,
1212
};
13+
use serde::{Deserialize, Serialize};
1314
use tokio_postgres::types::{FromSql, Type};
1415

1516
macro_rules! build_additional_rust_type {
@@ -292,8 +293,7 @@ impl<'a> FromSql<'a> for RustLineSegment {
292293
}
293294
}
294295

295-
#[derive(Eq, PartialEq, Clone, Copy, Debug, Hash)]
296-
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
296+
#[derive(Eq, PartialEq, Clone, Copy, Debug, Hash, Serialize, Deserialize)]
297297
pub struct Line<T: CoordNum = f64> {
298298
a: T,
299299
b: T,
@@ -471,7 +471,6 @@ impl<'a> FromSql<'a> for Line {
471471
// add macro for creating circles
472472

473473
#[derive(Eq, PartialEq, Clone, Copy, Debug, Hash)]
474-
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
475474
pub struct Circle<T: CoordNum = f64> {
476475
center: Coord<T>,
477476
radius: T,

0 commit comments

Comments
 (0)
0