xn-model 1.0.5__py3-none-any.whl → 1.0.6__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/models.py CHANGED
@@ -45,6 +45,13 @@ class Model(TrtModel):
45
45
  )
46
46
  return cls._pydIn
47
47
 
48
+ # # # CRUD Methods # # #
49
+ @classmethod
50
+ async def get_one(cls, id_: int) -> PydanticModel:
51
+ if obj := await cls.get_or_none(id=id_):
52
+ return await cls.pyd().from_tortoise_orm(obj)
53
+ raise LookupError(f"{cls.__name__}#{id_} not found")
54
+
48
55
  async def one(self) -> PydanticModel:
49
56
  return await self.pyd().from_tortoise_orm(self)
50
57
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xn-model
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: Base model for xn-api
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,8 @@
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=H_4bNlzzRJuo6qlfB9HLmWR421pIQHWWnBb2CDP-SfY,2830
5
+ xn_model-1.0.6.dist-info/METADATA,sha256=yc5mcKpcMB3eZoYalZ670MEdYTm6x4_D5EcHiU7jICY,961
6
+ xn_model-1.0.6.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
+ xn_model-1.0.6.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
8
+ xn_model-1.0.6.dist-info/RECORD,,
@@ -1,8 +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=sRHUZBbRlvIonmKgttyH7zd2aSQghRdZ4PfTwWgIDDs,2560
5
- xn_model-1.0.5.dist-info/METADATA,sha256=UXsrkrfG4fy3XfiIjspcHhJ9MF3r9WBYp8EQIE8CQAg,961
6
- xn_model-1.0.5.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
7
- xn_model-1.0.5.dist-info/top_level.txt,sha256=QCYyfv5AA_8jPPtCpShkBXzQRUCGuuW7Ro0mqysDE8E,8
8
- xn_model-1.0.5.dist-info/RECORD,,