mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-31 01:58:11 +08:00
migration: migrate NodeJS code base to Golang
This commit is contained in:
19
server/common/utils.go
Normal file
19
server/common/utils.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user