18 lines
279 B
Go
18 lines
279 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"math/rand"
|
||
|
)
|
||
|
|
||
|
func RandomString(length int) string {
|
||
|
arr := make([]rune, length)
|
||
|
for i := range arr {
|
||
|
arr[i] = 'a' + rune(rand.Intn(26))
|
||
|
}
|
||
|
return string(arr)
|
||
|
}
|
||
|
func ToTokenKey(token string) string {
|
||
|
return fmt.Sprintf("token_%s", token)
|
||
|
}
|