xxy aa98ea2623 @
Initial commit

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@
2026-06-05 18:45:29 +08:00

28 lines
567 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
database
数据库连接与 Session 管理。
使用方式:
from database import get_db, SessionLocal, init_database
# 依赖注入FastAPI 路由)
@router.get("/items")
def list_items(db: Session = Depends(get_db)):
...
# 上下文管理器脚本、worker
with SessionLocal() as db:
...
"""
from database.core import engine, SessionLocal
from database.dependencies import get_db
from database.init_db import init_database
__all__ = [
"engine",
"SessionLocal",
"get_db",
"init_database",
]