migration: migrate NodeJS code base to Golang

This commit is contained in:
Mickael Kerjean
2018-07-18 14:20:30 +10:00
parent c5f2839fd7
commit 04c97e34fb
68 changed files with 3837 additions and 2217 deletions

19
server/common/utils.go Normal file
View File

@ -0,0 +1,19 @@
package common
import (
"math/rand"
)
var Letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
func RandomString(n int) string {
b := make([]rune, n)
for i := range b {
b[i] = Letters[rand.Intn(len(Letters))]
}
return string(b)
}
func NewBool(t bool) *bool {
return &t
}