for more information visit the package's GitHub page
Package contains the following modules:
ULID is a 128bit number, designed for Universally Unique Lexicographically Sortable Identifier. For details please refer to the spec.
This package is an implementation of the ULID generators and utility functions in Elm.
Note ULID is NOT compatible with UUIDs, only common thing is that they are represented in 128-bit number.
Disclaimers:
import Random exposing (Seed, initialSeed, step)
import Task
import Time exposing (Posix)
import Ulid
time =
Time.millisToPosix 1558339537662
buildUlid integer =
let
initialSeed =
Random.initialSeed integer
( newUlid, seed ) =
step (Ulid.ulidGenerator time) initialSeed
in
newUlid
ulid =
buildUlid 1111
--> Ulid "01DBA4CJQYGPD539K02D574KC1"
ulidString =
Ulid.toString ulid
--> "01DBA4CJQYGPD539K02D574KC1"
maybeUlid =
Ulid.fromString ulidString
--> Just (Ulid "01DBA4CJQYGPD539K02D574KC1")