Refine api to support one batch command
This commit is contained in:
@@ -67,7 +67,7 @@ def get_option(name: str) -> dict[str, Any]:
|
||||
return d
|
||||
|
||||
|
||||
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
def set_option_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
|
||||
raw_old = get_option(name)
|
||||
|
||||
old = {}
|
||||
@@ -98,4 +98,8 @@ def set_option(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
undo_sql += f"update options set value = '{value}' where key = '{key}';"
|
||||
undo_cs |= { key: value }
|
||||
|
||||
return execute_command(name, redo_sql, undo_sql, redo_cs, undo_cs)
|
||||
return SqlChangeSet(redo_sql, undo_sql, redo_cs, undo_cs)
|
||||
|
||||
|
||||
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return execute_command(name, set_option_cache(name, cs))
|
||||
|
||||
Reference in New Issue
Block a user