View Source Ecto.ShortUUID (ecto_shortuuid v0.2.0)

An Ecto type for Short UUID strings.

Summary

Types

A raw binary representation of a UUID.

A base57 ShortUUID string.

A hex-encoded UUID string.

Functions

Casts the given input to ShortUUID

Dumps the given string representing a ShortUUID or UUID into a binary.

Ecto v3 callback Dictates how the type should be treated inside embeds.

Ecto v3 callback Checks if two terms are semantically equal.

Generates a ShortUUID string based on a version 4 (random) UUID.

Loads a binary UUID into a ShortUUID string.

The Ecto type.

Types

@type raw() :: <<_::128>>

A raw binary representation of a UUID.

@type shortuuid57() :: <<_::176>>

A base57 ShortUUID string.

@type uuid() :: <<_::288>>

A hex-encoded UUID string.

Functions

@spec cast(shortuuid57() | uuid() | any()) :: {:ok, shortuuid57()} | :error

Casts the given input to ShortUUID

https://hexdocs.pm/ecto/Ecto.Type.html#c:cast/1

@spec dump(shortuuid57() | uuid() | any()) :: {:ok, raw()} | :error

Dumps the given string representing a ShortUUID or UUID into a binary.

https://hexdocs.pm/ecto/Ecto.Type.html#c:dump/1

Ecto v3 callback Dictates how the type should be treated inside embeds.

https://hexdocs.pm/ecto/Ecto.Type.html#c:embed_as/1

Ecto v3 callback Checks if two terms are semantically equal.

https://hexdocs.pm/ecto/Ecto.Type.html#c:equal?/2

Generates a ShortUUID string based on a version 4 (random) UUID.

@spec load(binary()) :: {:ok, binary()} | :error

Loads a binary UUID into a ShortUUID string.

https://hexdocs.pm/ecto/Ecto.Type.html#c:load/1

The Ecto type.