Update change set
This commit is contained in:
@@ -1,12 +1,22 @@
|
|||||||
class ChangeSet:
|
class ChangeSet:
|
||||||
def __init__(self) -> None:
|
def __init__(self):
|
||||||
self.operations : list[dict[str, str]] = []
|
self.operations : list[dict[str, str]] = []
|
||||||
|
|
||||||
def add(self, type: str, id: str) -> None:
|
def add(self, type: str, id: str):
|
||||||
self.operations.append({ 'operation': 'add', 'type': type, 'id': id })
|
self.operations.append({ 'operation': 'add', 'type': type, 'id': id })
|
||||||
|
return self
|
||||||
|
|
||||||
def delete(self, type: str, id: str) -> None:
|
def delete(self, type: str, id: str):
|
||||||
self.operations.append({ 'operation': 'delete', 'type': type, 'id': id })
|
self.operations.append({ 'operation': 'delete', 'type': type, 'id': id })
|
||||||
|
return self
|
||||||
|
|
||||||
def update(self, type: str, id: str, property: str) -> None:
|
def update(self, type: str, id: str, properties: list[str]):
|
||||||
self.operations.append({ 'operation': 'update', 'type': type, 'id': id, 'property': property })
|
self.operations.append({ 'operation': 'update', 'type': type, 'id': id, 'properties': properties })
|
||||||
|
return self
|
||||||
|
|
||||||
|
def append(self, other) -> None:
|
||||||
|
self.operations += other.operations
|
||||||
|
return self
|
||||||
|
|
||||||
|
def compress(self) -> None:
|
||||||
|
return self
|
||||||
|
|||||||
Reference in New Issue
Block a user