Files
Mike Cohen 19d84ad127 Use a more compact flow_id for hunts. (#2472)
Flow IDs have the requirements that they are sortable with creation
time. We can reuse the hunt id in this context.
2023-02-24 03:37:17 +10:00

22 lines
397 B
Go

package utils
import "strings"
func ExtractHuntId(flow_id string) (string, bool) {
parts := strings.Split(flow_id, ".")
if len(parts) < 3 || parts[2] != "H" {
return "", false
}
return "H." + parts[1], true
}
func CreateFlowIdFromHuntId(hunt_id string) string {
parts := strings.SplitN(hunt_id, ".", 2)
if len(parts) != 2 {
return "F." + hunt_id
}
return "F." + parts[1] + ".H"
}