package genutils func UpsertIntoArray[T comparable](arr []T, values ...T) []T { outer: for _, value := range values { for _, value2 := range arr { if value2 == value { continue outer } } arr = append(arr, value) } return arr } func RemoveFromArray[T comparable](arr []T, values ...T) []T { for _, value := range values { for i, value2 := range arr { if value2 == value { arr = append(arr[:i], arr[i+1:]...) break } } } return arr }