From 498781f376a093a8ed4a6d687d36646cb7816aa1 Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Tue, 14 May 2024 17:09:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=90=8D=E5=86=99=E9=94=99=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_tetris_stats/db/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonebot_plugin_tetris_stats/db/models.py b/nonebot_plugin_tetris_stats/db/models.py index 7ce4133..068b983 100644 --- a/nonebot_plugin_tetris_stats/db/models.py +++ b/nonebot_plugin_tetris_stats/db/models.py @@ -33,7 +33,7 @@ class PydanticType(TypeDecorator): @override def process_bind_param(self, value: Any | None, dialect: Dialect) -> str: # 将 Pydantic 模型实例转换为 JSON - if isinstance(value, tuple(self.pydantic_models)): + if isinstance(value, tuple(self.models)): return value.model_dump_json(by_alias=True) # type: ignore[union-attr] raise TypeError else: @@ -41,7 +41,7 @@ class PydanticType(TypeDecorator): @override def process_bind_param(self, value: Any | None, dialect: Dialect) -> str: # 将 Pydantic 模型实例转换为 JSON - if isinstance(value, tuple(self.pydantic_models)): + if isinstance(value, tuple(self.models)): return value.json(by_alias=True) # type: ignore[union-attr] raise TypeError @@ -49,7 +49,7 @@ class PydanticType(TypeDecorator): def process_result_value(self, value: Any | None, dialect: Dialect) -> BaseModel: # 将 JSON 转换回 Pydantic 模型实例 if isinstance(value, str | bytes): - for i in self.pydantic_models: + for i in self.models: try: return type_validate_json(i, value) except ValidationError: # noqa: PERF203