View Source Solicit.UUID (solicit v1.3.2)

Utilities for working with UUIDs.

Link to this section Summary

Functions

Encodes a UUID in short hexadecimal format without any dashes. Generates a random UUID if none is provided.

Returns true if the given value is a UUID with the standard encoding.

Link to this section Functions

Link to this function

hex(uuid \\ Ecto.UUID.bingenerate())

View Source
@spec hex(Ecto.UUID.t() | Ecto.UUID.raw() | nil) :: binary()

Encodes a UUID in short hexadecimal format without any dashes. Generates a random UUID if none is provided.

examples

Examples

iex> Solicit.UUID.hex("7f3c1729-b7be-4eed-86a0-e843ac2219e8") "7f3c1729b7be4eed86a0e843ac2219e8"

iex> Solicit.UUID.hex(<<127, 60, 23, 41, 183, 190, 78, 237, 134, 160, 232, 67, 172, 34, 25, 232>>) "7f3c1729b7be4eed86a0e843ac2219e8"

@spec valid?(Ecto.UUID.t()) :: boolean()

Returns true if the given value is a UUID with the standard encoding.

examples

Examples

iex> Solicit.UUID.valid?("00000000-0000-0000-0000-000000000000") true

iex> Solicit.UUID.valid?("21985486-b01a-11ea-b3de-0242ac130004") true

iex> Solicit.UUID.valid?("🍉") false

iex> Solicit.UUID.valid?("John Jacob Jingle-Heimerschmidt") false

iex> Solicit.UUID.valid?("") false

iex> Solicit.UUID.valid?(" ") false

iex> Solicit.UUID.valid?(" ") false