mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add get_data
This commit is contained in:
parent
1ca8962459
commit
cef35e17f1
1 changed files with 14 additions and 2 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import json
|
||||
|
||||
from typing import Any, Dict, Mapping, Optional, cast
|
||||
|
||||
from aiosqlite import Connection, connect
|
||||
|
|
@ -109,4 +108,17 @@ class SqliteStorage(BaseStorage):
|
|||
await self._connection.commit()
|
||||
|
||||
async def get_data(self, key: StorageKey) -> Dict[str, Any]:
|
||||
pass
|
||||
id = self._key_builder.build(key)
|
||||
data_cell = {}
|
||||
|
||||
cursor = await self._connection.execute(
|
||||
f"""SELECT data
|
||||
FROM aiogram_fsm
|
||||
WHERE id = ?""",
|
||||
(id,),
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
|
||||
if row and row[0]:
|
||||
data_cell = cast(Dict[str, Any], json.loads(row[0]))
|
||||
return data_cell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue