From fc266b733cf0ea794209031e3500ab3f86db6cee Mon Sep 17 00:00:00 2001 From: Kalin Staykov Date: Sat, 26 Nov 2022 15:49:59 +0200 Subject: add wipe sub-command that remove local bugs and identities --- entity/dag/entity_actions.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'entity/dag/entity_actions.go') 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 +} -- cgit