diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-10 17:35:46 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-10 17:35:46 -0600 |
| commit | d8fd76b1c0c0bd86b2114dcf6af0b6e34d4783f3 (patch) | |
| tree | 32d71c0e6a9a0c25789ab90a29ef742001898afc /pkg/pls | |
| parent | a722bd0ef4f69547229921eb0fe2eefce3ed6397 (diff) | |
feat: add a single API endpoint to return a list of sparkles
Diffstat (limited to 'pkg/pls')
| -rw-r--r-- | pkg/pls/ulid.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/pls/ulid.go b/pkg/pls/ulid.go new file mode 100644 index 0000000..27e7d6c --- /dev/null +++ b/pkg/pls/ulid.go @@ -0,0 +1,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() +} |
