ToStrings works for any type where the base type is a string.
(a []T)
| 2 | |
| 3 | // ToStrings works for any type where the base type is a string. |
| 4 | func ToStrings[T ~string](a []T) []string { |
| 5 | tmp := make([]string, 0, len(a)) |
| 6 | for _, v := range a { |
| 7 | tmp = append(tmp, string(v)) |
| 8 | } |
| 9 | return tmp |
| 10 | } |
| 11 | |
| 12 | // List is a helper function to reduce boilerplate when converting slices of |
| 13 | // database types to slices of codersdk types. |
no outgoing calls
no test coverage detected
searching dependent graphs…