View Source Ulidex.Binary (ulidex v0.2.0)

Generates binary ULIDs.

Link to this section Summary

Types

t()

A 128 bit ULID consisting of

Link to this section Types

@type t() :: binary()

A 128 bit ULID consisting of:

  • 48 bits millisecond timestamp
  • 80 bits of randomness

Link to this section Functions

Link to this function

generate(timestamp \\ System.system_time(:millisecond))

View Source
@spec generate(integer()) :: t()

Generates a binary ULID.

examples

Examples

iex> ulid = Ulidex.Binary.generate()
iex> <<_::size(128)>> = ulid