refs.go
 1package entity
 2
 3import "strings"
 4
 5// RefsToIds parse a slice of git references and return the corresponding Entity's Id.
 6func RefsToIds(refs []string) []Id {
 7	ids := make([]Id, len(refs))
 8
 9	for i, ref := range refs {
10		ids[i] = RefToId(ref)
11	}
12
13	return ids
14}
15
16// RefToId parse a git reference and return the corresponding Entity's Id.
17func RefToId(ref string) Id {
18	split := strings.Split(ref, "/")
19	return Id(split[len(split)-1])
20}