Add List method to Routes singletone returning the list of numbered routes

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-10-09 09:54:15 +02:00
parent 4164f3e3de
commit 6810cb99ee
2 changed files with 33 additions and 0 deletions
+8
View File
@@ -35,3 +35,11 @@ func (srl *safeRouteList) Snapshot() []model.Route {
copy(rs, srl.rs)
return rs
}
func (srl *safeRouteList) List() []model.Route {
rs := srl.Snapshot()
for i := 0; i < len(rs); i++ {
rs[i].Index = i
}
return rs
}