xn-model 1.0.10__py3-none-any.whl → 1.0.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- x_model/field.py +8 -6
- x_model/types.py +5 -6
- {xn_model-1.0.10.dist-info → xn_model-1.0.12.dist-info}/METADATA +2 -2
- xn_model-1.0.12.dist-info/RECORD +9 -0
- {xn_model-1.0.10.dist-info → xn_model-1.0.12.dist-info}/WHEEL +1 -1
- xn_model-1.0.10.dist-info/RECORD +0 -9
- {xn_model-1.0.10.dist-info → xn_model-1.0.12.dist-info}/top_level.txt +0 -0
x_model/field.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
|
-
from asyncpg import Range # Box,
|
|
4
|
+
from asyncpg import Range, Point # Box, Polygon,
|
|
5
5
|
from tortoise import Model
|
|
6
6
|
from tortoise.contrib.postgres.fields import ArrayField
|
|
7
7
|
from tortoise.fields import Field, SmallIntField, IntField, FloatField, DatetimeField
|
|
@@ -51,11 +51,13 @@ class RangeField(CollectionField[Range]):
|
|
|
51
51
|
return value
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
class PointField(CollectionField[Point]):
|
|
55
|
+
SQL_TYPE = "POINT"
|
|
56
|
+
field_type = Point
|
|
57
|
+
base_field = FloatField
|
|
58
|
+
labels = ("lat", "lon")
|
|
59
|
+
|
|
60
|
+
|
|
59
61
|
#
|
|
60
62
|
#
|
|
61
63
|
# class PolygonField(ListField[Polygon]):
|
x_model/types.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
from typing import ClassVar
|
|
2
|
-
from
|
|
3
|
-
from msgspec.structs import asdict
|
|
2
|
+
from pydantic import BaseModel
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
class New(
|
|
5
|
+
class New(BaseModel):
|
|
7
6
|
_unq: ClassVar[tuple[str]] = ()
|
|
8
7
|
|
|
9
|
-
def df_unq(self
|
|
10
|
-
d = {k: v for k, v in
|
|
11
|
-
return {**{k: d.pop(k) for k in set(self._unq)
|
|
8
|
+
def df_unq(self) -> dict:
|
|
9
|
+
d = {k: v for k, v in self.model_dump(exclude_none=True).items()}
|
|
10
|
+
return {**{k: d.pop(k, None) for k in set(self._unq)}, "defaults": d}
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class Upd(New):
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
|
|
2
|
+
x_model/field.py,sha256=zVszcPZFVEwsurqbFQF-_caiSLruh3TRSZdgQqwWJV8,2776
|
|
3
|
+
x_model/func.py,sha256=E7jDoHJGaFpKvxbHnT_lyBxUZeMo-GRd5gv9dLw7B9s,289
|
|
4
|
+
x_model/models.py,sha256=-dhEPBoOIcMvkWayjgOBt9xYiOalv8ZIM9bmFziVdzM,2710
|
|
5
|
+
x_model/types.py,sha256=u3oYmN1g2BpPUvmvPowuNh1lL3z4zJroJKsGre5Yxds,352
|
|
6
|
+
xn_model-1.0.12.dist-info/METADATA,sha256=3-hj5vYl54hSa71r0Vfp8jVsCSz0naer2Jjtkc4DgCY,962
|
|
7
|
+
xn_model-1.0.12.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
|
|
8
|
+
xn_model-1.0.12.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
+
xn_model-1.0.12.dist-info/RECORD,,
|
xn_model-1.0.10.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
x_model/__init__.py,sha256=JRsYD3P-8pHpEkCUgy6GuodkT7ZaY1AEeEK1CbpgZw4,428
|
|
2
|
-
x_model/field.py,sha256=w5BAoNA33a-uROaExx5Pr3jYQnUMKIYFYcPTjdBlx3M,2784
|
|
3
|
-
x_model/func.py,sha256=E7jDoHJGaFpKvxbHnT_lyBxUZeMo-GRd5gv9dLw7B9s,289
|
|
4
|
-
x_model/models.py,sha256=-dhEPBoOIcMvkWayjgOBt9xYiOalv8ZIM9bmFziVdzM,2710
|
|
5
|
-
x_model/types.py,sha256=FEb0dPkmeU7sz_To1iT3-yk4UOD7S8xfiHGoYIFEpk0,432
|
|
6
|
-
xn_model-1.0.10.dist-info/METADATA,sha256=4NkzzJAq2EuhxVlBI0Tj6MCsdjoKoTuUpEgbXfxEWps,962
|
|
7
|
-
xn_model-1.0.10.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
8
|
-
xn_model-1.0.10.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
|
|
9
|
-
xn_model-1.0.10.dist-info/RECORD,,
|
|
File without changes
|