View Source Ecto.UUID (Ecto v3.10.3)

An Ecto type for UUID strings.

Summary

Types

A raw binary representation of a UUID.

t()

A hex-encoded UUID string.

Functions

Generates a random, version 4 UUID in the binary format.

Casts to a UUID.

Same as cast/1 but raises Ecto.CastError on invalid arguments.

Converts a string representing a UUID into a raw binary.

Same as dump/1 but raises Ecto.ArgumentError on invalid arguments.

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

Generates a random, version 4 UUID.

Converts a binary UUID into a string.

Same as load/1 but raises Ecto.ArgumentError on invalid arguments.

Types

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

A raw binary representation of a UUID.

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

A hex-encoded UUID string.

Functions

@spec bingenerate() :: raw()

Generates a random, version 4 UUID in the binary format.

@spec cast(t() | raw() | any()) :: {:ok, t()} | :error

Casts to a UUID.

@spec cast!(t() | raw() | any()) :: t()

Same as cast/1 but raises Ecto.CastError on invalid arguments.

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

Converts a string representing a UUID into a raw binary.

@spec dump!(t() | any()) :: raw()

Same as dump/1 but raises Ecto.ArgumentError on invalid arguments.

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

@spec generate() :: t()

Generates a random, version 4 UUID.

@spec load(raw() | any()) :: {:ok, t()} | :error

Converts a binary UUID into a string.

@spec load!(raw() | any()) :: t()

Same as load/1 but raises Ecto.ArgumentError on invalid arguments.