mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Update method get_value
This commit is contained in:
parent
da278c8a1d
commit
61dfd60781
2 changed files with 4 additions and 4 deletions
|
|
@ -20,8 +20,8 @@ class FSMContext:
|
|||
async def get_data(self) -> Dict[str, Any]:
|
||||
return await self.storage.get_data(key=self.key)
|
||||
|
||||
async def get_value(self, key: str) -> Any:
|
||||
return await self.storage.get_value(key=self.key, data_key=key)
|
||||
async def get_value(self, key: str, default: Any = None) -> Any:
|
||||
return await self.storage.get_value(key=self.key, data_key=key, default=default)
|
||||
|
||||
async def update_data(
|
||||
self, data: Optional[Dict[str, Any]] = None, **kwargs: Any
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class BaseStorage(ABC):
|
|||
"""
|
||||
pass
|
||||
|
||||
async def get_value(self, key: StorageKey, data_key: str) -> Any:
|
||||
async def get_value(self, key: StorageKey, data_key: str, default: Any) -> Any:
|
||||
"""
|
||||
Get selected value by key in current data
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ class BaseStorage(ABC):
|
|||
:return: value of current data by key
|
||||
"""
|
||||
current_data = await self.get_data(key=key)
|
||||
return current_data[data_key]
|
||||
return current_data.get(data_key)
|
||||
|
||||
async def update_data(self, key: StorageKey, data: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue