feat: add standards wiki, MCP registry, and app template
This commit is contained in:
23
templates/app/infra/db/setup.py
Normal file
23
templates/app/infra/db/setup.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""# Summary
|
||||
|
||||
Database setup — connection lifecycle only. No domain imports.
|
||||
|
||||
Connect and disconnect the shared Mongo connection manager at application
|
||||
startup and shutdown.
|
||||
"""
|
||||
from mongo_ops import MongoConnectionManager
|
||||
|
||||
|
||||
async def setup_database(uri: str, db_name: str):
|
||||
"""Connect the shared Mongo connection manager.
|
||||
|
||||
Args:
|
||||
uri (str): Mongo connection URI.
|
||||
db_name (str): Target database name.
|
||||
"""
|
||||
await MongoConnectionManager.connect(uri=uri, db_name=db_name)
|
||||
|
||||
|
||||
async def shutdown_database():
|
||||
"""Disconnect the shared Mongo connection manager."""
|
||||
await MongoConnectionManager.disconnect()
|
||||
Reference in New Issue
Block a user