We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent efaea09 commit 75745d9Copy full SHA for 75745d9
template_fastapi/repositories/restaurants.py
@@ -17,7 +17,14 @@ class RestaurantRepository:
17
"""レストランデータを管理するリポジトリクラス"""
18
19
def __init__(self):
20
- self.container = self._setup_cosmos_client()
+ self._container = None
21
+
22
+ @property
23
+ def container(self):
24
+ """コンテナを遅延初期化するプロパティ"""
25
+ if self._container is None:
26
+ self._container = self._setup_cosmos_client()
27
+ return self._container
28
29
def _setup_cosmos_client(self):
30
"""Azure Cosmos DBに接続するクライアントを設定する"""
0 commit comments