(v []T, sourceName string)
| 10 | const MultipleKeyPartsLength = 2 |
| 11 | |
| 12 | func PickRandom[T any](v []T, sourceName string) T { |
| 13 | var result T |
| 14 | length := len(v) |
| 15 | if length == 0 { |
| 16 | gologger.Debug().Msgf("Cannot use the %s source because there was no API key/secret defined for it.", sourceName) |
| 17 | return result |
| 18 | } |
| 19 | return v[rand.Intn(length)] |
| 20 | } |
| 21 | |
| 22 | func CreateApiKeys[T any](keys []string, provider func(k, v string) T) []T { |
| 23 | var result []T |