Try change set to record result

This commit is contained in:
wqy
2022-09-06 21:33:09 +08:00
parent 57728681b6
commit c99a1d728b
3 changed files with 23 additions and 0 deletions

14
api/change_set.py Normal file
View File

@@ -0,0 +1,14 @@
class ChangeSet:
def __init__(self) -> None:
self.added : list[dict[str, str]] = {}
self.deleted : list[dict[str, str]] = {}
self.updated : list[dict[str, str]] = {}
def add(self, type: str, id: str) -> None:
self.added.append({ 'type': type, 'id': id })
def delete(self, type: str, id: str) -> None:
self.deleted.append({ 'type': type, 'id': id })
def update(self, type: str, id: str, property: str) -> None:
self.updated.append({ 'type': type, 'id': id, 'property': property })