2020-11-19 15:57:57 +03:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2021-01-04 01:59:25 +03:00
|
|
|
// RefsToIds parse a slice of git references and return the corresponding Entity's Id.
|
2020-11-19 15:57:57 +03:00
|
|
|
func RefsToIds(refs []string) []Id {
|
|
|
|
ids := make([]Id, len(refs))
|
|
|
|
|
|
|
|
for i, ref := range refs {
|
2020-11-08 21:15:06 +03:00
|
|
|
ids[i] = RefToId(ref)
|
2020-11-19 15:57:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return ids
|
|
|
|
}
|
|
|
|
|
2022-03-10 18:27:22 +03:00
|
|
|
// RefToId parse a git reference and return the corresponding Entity's Id.
|
2020-11-08 21:15:06 +03:00
|
|
|
func RefToId(ref string) Id {
|
2020-11-19 15:57:57 +03:00
|
|
|
split := strings.Split(ref, "/")
|
|
|
|
return Id(split[len(split)-1])
|
|
|
|
}
|