aboutsummaryrefslogtreecommitdiffstats
path: root/entity/dag/entity_actions.go
diff options
context:
space:
mode:
Diffstat (limited to 'entity/dag/entity_actions.go')
-rw-r--r--entity/dag/entity_actions.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/entity/dag/entity_actions.go b/entity/dag/entity_actions.go
index 97a68c36..5f0abec3 100644
--- a/entity/dag/entity_actions.go
+++ b/entity/dag/entity_actions.go
@@ -258,3 +258,19 @@ func Remove(def Definition, repo repository.ClockedRepo, id entity.Id) error {
return nil
}
+
+// RemoveAll delete all Entity matching the Definition.
+// RemoveAll is idempotent.
+func RemoveAll(def Definition, repo repository.ClockedRepo) error {
+ localIds, err := ListLocalIds(def, repo)
+ if err != nil {
+ return err
+ }
+ for _, id := range localIds {
+ err = Remove(def, repo, id)
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}