diff options
author | Lint Action <[email protected]> | 2023-04-06 08:09:28 +0000 |
---|---|---|
committer | Lint Action <[email protected]> | 2023-04-06 08:09:28 +0000 |
commit | 687b087f83c6565efdeb72c3b00ff13ef6b8c8f1 (patch) | |
tree | 891bac80c677479492b26fed9e6da23538af2b87 /ATRI/database | |
parent | 60be1eb2bd16fc89827a50ad18377642aae176be (diff) | |
download | ATRI-687b087f83c6565efdeb72c3b00ff13ef6b8c8f1.tar.gz ATRI-687b087f83c6565efdeb72c3b00ff13ef6b8c8f1.tar.bz2 ATRI-687b087f83c6565efdeb72c3b00ff13ef6b8c8f1.zip |
:rotating_light: 自动进行代码格式化
Diffstat (limited to 'ATRI/database')
-rw-r--r-- | ATRI/database/wrapper.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ATRI/database/wrapper.py b/ATRI/database/wrapper.py index 7838bd6..df6057f 100644 --- a/ATRI/database/wrapper.py +++ b/ATRI/database/wrapper.py @@ -6,7 +6,7 @@ from tortoise.models import Model class DatabaseWrapper: def __init__(self, model: Type[Model]): self.model = model - + async def __aenter__(self): return self @@ -15,17 +15,15 @@ class DatabaseWrapper: async def add_sub(self, *args, **kwargs): await self.model.create(*args, **kwargs) - + async def update_sub(self, update_map: dict, **kwargs): - await self.model.filter(**kwargs).update( - **update_map - ) + await self.model.filter(**kwargs).update(**update_map) async def del_sub(self, query_map: dict): await self.model.filter(**query_map).delete() - + async def get_sub_list(self, query_map: dict) -> list: return await self.model.filter(**query_map) - + async def get_all_subs(self) -> list: return await self.model.all() |