begin move to go-restful
This commit is contained in:
22
cmd/dkl-local-server/ulid.go
Normal file
22
cmd/dkl-local-server/ulid.go
Normal 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()
|
||||
}
|
Reference in New Issue
Block a user