modify: session 代码提示
This commit is contained in:
@@ -25,7 +25,7 @@ class Database:
|
||||
expire_on_commit=False
|
||||
) # type: ignore
|
||||
|
||||
def get_session(self):
|
||||
def get_session(self) -> AsyncSession:
|
||||
"""返回一个异步上下文管理器,用于获取会话"""
|
||||
if self._session_maker is None:
|
||||
raise RuntimeError("Database not initialized")
|
||||
@@ -36,4 +36,4 @@ class Database:
|
||||
if self._engine:
|
||||
await self._engine.dispose()
|
||||
self._engine = None
|
||||
self._session_maker = None
|
||||
self._session_maker = None
|
||||
|
||||
Reference in New Issue
Block a user