summaryrefslogtreecommitdiff
path: root/internal/id/ulid.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2021-09-03 10:27:40 +0100
committerLibravatar GitHub <noreply@github.com>2021-09-03 10:27:40 +0100
commit25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687 (patch)
treeb6cffb65d46a07f59d5393a257973910d4116227 /internal/id/ulid.go
parentsession name fix (#185) (diff)
parentreview changes (diff)
downloadgotosocial-25edd57eaf3eecf0b449a4dabb5b5fc5d6ae7687.tar.xz
Merge pull request #186 from superseriousbusiness/struct_validation
Struct validation
Diffstat (limited to 'internal/id/ulid.go')
-rw-r--r--internal/id/ulid.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/id/ulid.go b/internal/id/ulid.go
index b488ddfc4..1b0c2e537 100644
--- a/internal/id/ulid.go
+++ b/internal/id/ulid.go
@@ -10,6 +10,9 @@ import (
const randomRange = 631152381 // ~20 years in seconds
+// ULID represents a Universally Unique Lexicographically Sortable Identifier of 26 characters. See https://github.com/oklog/ulid
+type ULID string
+
// NewULID returns a new ULID string using the current time, or an error if something goes wrong.
func NewULID() (string, error) {
newUlid, err := ulid.New(ulid.Timestamp(time.Now()), rand.Reader)