pyrofork/pyrogram/storage/sqlite/cursor.py
wulan17 2a93257fa2
PyroFork: Add async helper, and wrap sqlite3
Signed-off-by: wulan17 <wulan17@nusantararom.org>
2023-06-23 00:20:01 +07:00

10 lines
272 B
Python

from pyrogram.utils import run_sync
from sqlite3 import Cursor
from threading import Thread
class AsyncCursor(Thread):
def __init__(self, cursor: Cursor):
self.cursor = cursor
async def fetchone(self):
return await run_sync(self.cursor.fetchone)