You've already forked golang-base-project
Adds godoc comments
This commit is contained in:
14
ulid/generate.go
Normal file
14
ulid/generate.go
Normal file
@ -0,0 +1,14 @@
|
||||
package ulid
|
||||
|
||||
import (
|
||||
"github.com/oklog/ulid/v2"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Generate a new ULID string
|
||||
func Generate() string {
|
||||
entropy := ulid.Monotonic(rand.New(rand.NewSource(time.Now().UnixNano())), 0)
|
||||
res := ulid.MustNew(ulid.Timestamp(time.Now()), entropy)
|
||||
return res.String()
|
||||
}
|
Reference in New Issue
Block a user