A Clojure port of alizain/ulid
A GUID/UUID can be suboptimal for many use-cases because:
A ULID however:
Generating a ULID String requires a ULID instance.
(require '[clj-ulid :as ulid])
; Generate ULID
(ulid/ulid)
; => "01bpf8bvjp4qas6vkg9maa13b5"
; Generate ULID from timestamp (useful for migrations)
(ulid/ulid 1501602817887)
; => "01bpf819tzbqdgxryyf664y7vs"
; Get embedded timestamp from ULID
(ulid/ulid->timestamp "01bpf819tzbqdgxryyf664y7vs")
; => 1501602817887
Below is the current specification of ULID as implemented in this repository.
Timestamp
Entropy
Crockford's Base32 is used as shown. This alphabet excludes the letters I, L, O, and U to avoid confusion and abuse.
0123456789ABCDEFGHJKMNPQRSTVWXYZ
01AN4Z07BY 79KA1307SR9X4MV3
|----------| |----------------|
Timestamp Entropy
10 chars 16 chars
48bits 80bits
base32 base32
lein test
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close