Fix module in terms of python style

This commit is contained in:
wqy
2022-09-02 18:33:33 +08:00
parent 4474f12d2c
commit bed5741558
11 changed files with 214 additions and 185 deletions

11
api/s1_title.py Normal file
View File

@@ -0,0 +1,11 @@
from psycopg.rows import dict_row
from api.connection import g_conn_dict as conn
def set_title(name: str, value: str) -> None:
with conn[name].cursor() as cur:
cur.execute(f"update title set value = '{value}'")
def get_title(name: str) -> str:
with conn[name].cursor(row_factory=dict_row) as cur:
cur.execute(f"select * from title")
return cur.fetchone()['value']