xn-model 1.0.8__tar.gz → 1.0.10__tar.gz
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.
- {xn_model-1.0.8/xn_model.egg-info → xn_model-1.0.10}/PKG-INFO +1 -1
- {xn_model-1.0.8 → xn_model-1.0.10}/x_model/models.py +2 -2
- xn_model-1.0.10/x_model/types.py +17 -0
- {xn_model-1.0.8 → xn_model-1.0.10/xn_model.egg-info}/PKG-INFO +1 -1
- xn_model-1.0.8/x_model/types.py +0 -15
- {xn_model-1.0.8 → xn_model-1.0.10}/.env.sample +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/.gitignore +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/.pre-commit-config.yaml +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/README.md +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/makefile +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/pyproject.toml +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/setup.cfg +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/tests/__init__.py +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/tests/test_db.py +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/x_model/__init__.py +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/x_model/field.py +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/x_model/func.py +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/xn_model.egg-info/SOURCES.txt +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/xn_model.egg-info/dependency_links.txt +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/xn_model.egg-info/requires.txt +0 -0
- {xn_model-1.0.8 → xn_model-1.0.10}/xn_model.egg-info/top_level.txt +0 -0
|
@@ -28,13 +28,13 @@ class Model(TortModel):
|
|
|
28
28
|
@classmethod
|
|
29
29
|
def out_type(cls):
|
|
30
30
|
if not cls._out_type:
|
|
31
|
-
cls.
|
|
31
|
+
cls._out_type = pydantic_model_creator(cls, name=cls.__name__ + "Out")
|
|
32
32
|
return cls._out_type
|
|
33
33
|
|
|
34
34
|
@classmethod
|
|
35
35
|
def in_type(cls):
|
|
36
36
|
if not cls._in_type:
|
|
37
|
-
cls.
|
|
37
|
+
cls._in_type = pydantic_model_creator(
|
|
38
38
|
cls, name=cls.__name__ + "In", exclude_readonly=True, meta_override=cls.PydanticMetaIn
|
|
39
39
|
)
|
|
40
40
|
return cls._in_type
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from typing import ClassVar
|
|
2
|
+
from msgspec import Struct
|
|
3
|
+
from msgspec.structs import asdict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class New(Struct):
|
|
7
|
+
_unq: ClassVar[tuple[str]] = ()
|
|
8
|
+
|
|
9
|
+
def df_unq(self, frozen_props: tuple[str] = ()) -> dict:
|
|
10
|
+
d = {k: v for k, v in asdict(self).items() if v is not None or k in frozen_props}
|
|
11
|
+
return {**{k: d.pop(k) for k in set(self._unq) & d.keys()}, "defaults": d}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Upd(New):
|
|
15
|
+
_unq = ("id",)
|
|
16
|
+
|
|
17
|
+
id: int
|
xn_model-1.0.8/x_model/types.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from pydantic import BaseModel
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class New(BaseModel):
|
|
5
|
-
_unq: list[str] = []
|
|
6
|
-
|
|
7
|
-
def df_unq(self) -> dict:
|
|
8
|
-
d = self.model_dump(exclude_none=True)
|
|
9
|
-
return {**{k: d.pop(k) for k in set(self._unq) & d.keys()}, "defaults": d}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class Upd(New):
|
|
13
|
-
_unq: list[str] = ["id"]
|
|
14
|
-
|
|
15
|
-
id: int
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|