Initial commit

This commit is contained in:
r 2019-12-13 18:08:26 +00:00
commit 5e4da01c3a
43 changed files with 3429 additions and 0 deletions

22
util/rand.go Normal file
View file

@ -0,0 +1,22 @@
package util
import (
"math/rand"
)
var (
runes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
runes_length = len(runes)
)
func NewRandId(n int) string {
data := make([]rune, n)
for i := range data {
data[i] = runes[rand.Intn(runes_length)]
}
return string(data)
}
func NewSessionId() string {
return NewRandId(24)
}