feat(mysql): 添加MySQL数据库支持

- 在requirements.txt中添加aiomysql依赖
- 在config.toml中添加MySQL配置块
- 新增MySQLModel配置模型
- 实现MySQLManager单例管理器
- 更新Config类以支持MySQL配置加载
- 在__init__.py中导出mysql_manager
- 改进ConfigError异常处理
This commit is contained in:
2026-02-28 16:59:52 +08:00
parent 0bca97424b
commit ed4da64a7a
7 changed files with 203 additions and 13 deletions

View File

@@ -83,14 +83,15 @@ class ConfigError(Exception):
配置相关错误的基类。
Args:
section: 配置部分名称
key: 配置项名称
message: 错误消息
section: 配置部分名称(可选)
key: 配置项名称(可选)
message: 错误消息(可选)
"""
def __init__(self, section=None, key=None, message=None):
self.section = section
self.key = key
self.message = message
self.original_error = None
if section and key and message:
super().__init__(f"配置错误 [{section}.{key}]: {message}")