mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
✨ PydanticType dump model 的时候会使用 by_alias=True
This commit is contained in:
@@ -26,7 +26,7 @@ class PydanticType(TypeDecorator):
|
|||||||
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
def process_bind_param(self, value: Any | None, dialect: Dialect) -> str:
|
||||||
# 将 Pydantic 模型实例转换为 JSON
|
# 将 Pydantic 模型实例转换为 JSON
|
||||||
if isinstance(value, tuple(self.get_model())):
|
if isinstance(value, tuple(self.get_model())):
|
||||||
return value.json() # type: ignore[union-attr]
|
return value.json(by_alias=True) # type: ignore[union-attr]
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user