Skip to content

Commit

Permalink
✏️ 变量名写错了
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed May 14, 2024
1 parent a3c00db commit 498781f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nonebot_plugin_tetris_stats/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ def __init__(
@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:

@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

@override
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
Expand Down

0 comments on commit 498781f

Please sign in to comment.