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

@@ -67,7 +67,7 @@ def get_option(name: str) -> dict[str, Any]:
return d
def set_option_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
def set_option_cache(name: str, cs: ChangeSet) -> DbChangeSet:
raw_old = get_option(name)
old = {}
@@ -98,7 +98,7 @@ def set_option_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
undo_sql += f"update options set value = '{value}' where key = '{key}';"
undo_cs |= { key: value }
return SqlChangeSet(redo_sql, undo_sql, redo_cs, undo_cs)
return DbChangeSet(redo_sql, undo_sql, [redo_cs], [undo_cs])
def set_option(name: str, cs: ChangeSet) -> ChangeSet: