MossChat_Backend/utils/utils.go

18 lines
279 B
Go
Raw Permalink Normal View History

2024-06-16 02:08:50 +08:00
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)
}