将 native/api/ 改名为 native/wndb/,避免与 Web API 层命名冲突

This commit is contained in:
2026-03-09 12:13:27 +08:00
parent 6b85cfc666
commit 20ab08e206
87 changed files with 33 additions and 33 deletions
+40
View File
@@ -0,0 +1,40 @@
from .database import *
def get_title_schema(name: str) -> dict[str, dict[str, Any]]:
return {'value': {'type': 'float', 'optional': False, 'readonly': False}}
def get_title(name: str) -> dict[str, Any]:
title = read(name, 'select * from title')
return { 'value': title['value'] }
def _set_title(name: str, cs: ChangeSet) -> DbChangeSet:
new = cs.operations[0]['value']
old = get_title(name)['value']
redo_sql = f"update title set value = '{new}';"
undo_sql = f"update title set value = '{old}';"
redo_cs = g_update_prefix | { 'type': 'title', 'value': new }
undo_cs = g_update_prefix | { 'type': 'title', 'value': old }
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_title(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, _set_title(name ,cs))
def inp_in_title(section: list[str]) -> str:
if section == []:
return str('')
title = '\n'.join(section)
return str(f"update title set value = '{title}';")
def inp_out_title(name: str) -> list[str]:
obj = str(get_title(name)['value'])
return obj.split('\n')