blob: 27e7d6c1a7a3fb2550514562deda83113f793b41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package pls
import (
"math/rand"
"time"
"github.com/oklog/ulid"
)
func GenerateULID() string {
seed := time.Now().UnixNano()
source := rand.NewSource(seed)
entropy := rand.New(source)
id, _ := ulid.New(ulid.Timestamp(time.Now()), entropy)
return id.String()
}
|