Ecto.ULID (Ecto.ULID v0.3.0) View Source
An Ecto type for ULID strings.
Link to this section Summary
Functions
Generates a binary ULID.
Casts a string to ULID.
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Converts a Crockford Base32 encoded ULID into a binary.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Generates a Crockford Base32 encoded ULID.
Converts a binary ULID into a Crockford Base32 encoded string.
The underlying schema type.
Link to this section Functions
Generates a binary ULID.
If a value is provided for timestamp
, the generated ULID will be for the provided timestamp.
Otherwise, a ULID will be generated for the current time.
Arguments:
timestamp
: A Unix timestamp with millisecond precision.
Casts a string to ULID.
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Converts a Crockford Base32 encoded ULID into a binary.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Generates a Crockford Base32 encoded ULID.
If a value is provided for timestamp
, the generated ULID will be for the provided timestamp.
Otherwise, a ULID will be generated for the current time.
Arguments:
timestamp
: A Unix timestamp with millisecond precision.
Converts a binary ULID into a Crockford Base32 encoded string.
The underlying schema type.