Refine api to support one batch command

This commit is contained in:
WQY\qiong
2022-10-26 19:35:04 +08:00
parent 78d7be1d9a
commit 65e2ce2541
16 changed files with 182 additions and 178 deletions

View File

@@ -30,7 +30,7 @@ class Emitter(object):
return { 'type': self.type, 'junction': self.junction, 'coefficient': self.coefficient }
def set_emitter(name: str, cs: ChangeSet) -> ChangeSet:
def set_emitter_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
old = Emitter(get_emitter(name, cs.operations[0]['junction']))
raw_new = get_emitter(name, cs.operations[0]['junction'])
@@ -52,4 +52,8 @@ def set_emitter(name: str, cs: ChangeSet) -> ChangeSet:
redo_cs = g_update_prefix | new.as_dict()
undo_cs = g_update_prefix | old.as_dict()
return execute_command(name, redo_sql, undo_sql, redo_cs, undo_cs)
return SqlChangeSet(redo_sql, undo_sql, redo_cs, undo_cs)
def set_emitter(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, set_emitter_cache(name, cs))