begin move to go-restful

This commit is contained in:
Mikaël Cluseau
2019-02-01 18:28:08 +11:00
parent 92d3142d96
commit f4f285d0dc
8 changed files with 228 additions and 8 deletions

View File

@ -0,0 +1,22 @@
package main
import (
"io"
"math/rand"
"time"
ulidp "github.com/oklog/ulid"
)
var (
ulidCtx struct{ entropy io.Reader }
)
func initUlid() {
entropy := ulidp.Monotonic(rand.New(rand.NewSource(time.Now().UnixNano())), 0)
ulidCtx.entropy = entropy
}
func ulid() string {
return ulidp.MustNew(ulidp.Now(), ulidCtx.entropy).String()
}