From 687b087f83c6565efdeb72c3b00ff13ef6b8c8f1 Mon Sep 17 00:00:00 2001 From: Lint Action <noreply@github.com> Date: Thu, 6 Apr 2023 08:09:28 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/database/wrapper.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'ATRI/database/wrapper.py') 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() -- cgit v1.2.3