Code refactor for change set

This commit is contained in:
WQY\qiong
2022-12-17 09:23:08 +08:00
parent f6c14f1c81
commit b715f330dd
25 changed files with 131 additions and 190 deletions

View File

@@ -13,7 +13,7 @@ def get_control(name: str) -> dict[str, Any]:
return { 'controls': ds }
def set_control_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
def set_control_cache(name: str, cs: ChangeSet) -> DbChangeSet:
old = get_control(name)
redo_sql = 'delete from controls;'
@@ -27,7 +27,7 @@ def set_control_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
redo_cs = g_update_prefix | { 'type': 'control', 'controls': cs.operations[0]['controls'] }
undo_cs = g_update_prefix | { 'type': 'control', 'controls': old['controls'] }
return SqlChangeSet(redo_sql, undo_sql, redo_cs, undo_cs)
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_control(name: str, cs: ChangeSet) -> ChangeSet: