ULID generation, parsing, and utilities.
Implements the ULID spec:
ULID generation, parsing, and utilities. Implements the ULID spec: - 26-char Crockford Base32 encoded string - 48-bit timestamp (millisecond Unix epoch) + 80-bit random component - Lexicographically sortable - Monotonic generation within same millisecond
(decode ulid)Decode a ULID string into a 16-byte byte array.
Decode a ULID string into a 16-byte byte array.
(encode byte-arr)Encode a 16-byte byte array into a ULID string.
Encode a 16-byte byte array into a ULID string.
(gen)(gen timestamp)Generate a new ULID string. Returns a 26-character Crockford Base32 encoded ULID.
Generate a new ULID string. Returns a 26-character Crockford Base32 encoded ULID.
(monotonic generator-atom)Generate a monotonically increasing ULID using an explicit state atom.
Usage: (def gen (atom nil)) (identika.ulid/monotonic gen) ;; returns ULID with guaranteed increasing order
The atom holds the last generated ULID string. If the next call falls within the same millisecond, the random component is incremented. If the timestamp advances, a fresh ULID is generated.
Generate a monotonically increasing ULID using an explicit state atom. Usage: (def gen (atom nil)) (identika.ulid/monotonic gen) ;; returns ULID with guaranteed increasing order The atom holds the last generated ULID string. If the next call falls within the same millisecond, the random component is incremented. If the timestamp advances, a fresh ULID is generated.
(next-ulid ulid-str)Return the next ULID in lexicographic sort order after ulid-str.
Increments the random component, carrying into the timestamp if overflow.
Returns nil if ulid-str is not a valid ULID.
Return the next ULID in lexicographic sort order after `ulid-str`. Increments the random component, carrying into the timestamp if overflow. Returns nil if `ulid-str` is not a valid ULID.
(timestamp ulid)Extract the timestamp from a ULID string as a java.time.Instant.
Extract the timestamp from a ULID string as a java.time.Instant.
(valid? ulid)Return true if is a valid ULID string (26-char Crockford Base32).
Return true if is a valid ULID string (26-char Crockford Base32).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |