Optimized sorting methods across nodes and profiles

This commit is contained in:
Gregory Kurtzer
2021-04-25 15:43:35 -07:00
parent a321709901
commit 4bc523a052
15 changed files with 266 additions and 234 deletions

View File

@@ -1,5 +1,32 @@
package node
import "regexp"
/**********
*
* Filters
*
*********/
func FilterByName(set []NodeInfo, searchList []string) []NodeInfo {
var ret []NodeInfo
if len(searchList) > 0 {
for _, search := range searchList {
for _, entry := range set {
b, _ := regexp.MatchString(search, entry.Id.Get())
if b {
ret = append(ret, entry)
}
}
}
} else {
ret = set
}
return ret
}
/**********
*
* Sets