github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/utils/uid.go (about) 1 package utils 2 3 import ( 4 "math/rand" 5 "time" 6 7 "github.com/oklog/ulid/v2" 8 ) 9 10 func NewUniqueId() string { 11 t := time.Now() 12 entropy := ulid.Monotonic(rand.New(rand.NewSource(t.UnixNano())), 0) 13 return ulid.MustNew(ulid.Timestamp(t), entropy).String() 14 }