Liking cljdoc? Tell your friends :D

identika.ulid

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
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
raw docstring

decodeclj

(decode ulid)

Decode a ULID string into a 16-byte byte array.

Decode a ULID string into a 16-byte byte array.
sourceraw docstring

encodeclj

(encode byte-arr)

Encode a 16-byte byte array into a ULID string.

Encode a 16-byte byte array into a ULID string.
sourceraw docstring

genclj

(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.
sourceraw docstring

monotonicclj

(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.
sourceraw docstring

next-ulidclj

(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.
sourceraw docstring

timestampclj

(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.
sourceraw docstring

valid?clj

(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).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close