Add method ListIDs() to internal/data/Handlers

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-10-10 13:11:05 +02:00
parent a39e0f6605
commit b76fb1f77e
2 changed files with 67 additions and 1 deletions
+9
View File
@@ -38,3 +38,12 @@ func (shm *safeHandlerMap) Get(id string) (*model.Handler, bool) {
shm.m.RUnlock()
return h, ok
}
func (shm *safeHandlerMap) ListIDs() (ids []string) {
shm.m.RLock()
defer shm.m.RUnlock()
for id := range shm.hs {
ids = append(ids, id)
}
return
}