Add status api and test

This commit is contained in:
WQY\qiong
2022-10-22 11:51:48 +08:00
parent 6fa2f77a60
commit c1b99bc7eb
7 changed files with 171 additions and 5 deletions

View File

@@ -57,6 +57,12 @@ def read_all(name: str, sql: str) -> list[Row]:
return cur.fetchall()
def try_read(name: str, sql: str) -> Row | None:
with conn[name].cursor(row_factory=dict_row) as cur:
cur.execute(sql)
return cur.fetchone()
def write(name: str, sql: str) -> None:
with conn[name].cursor() as cur:
cur.execute(sql)