Construct.Types v0.1.0 Construct.Types.UUID View Source

Checks that provided binary is UUID-like string:

defmodule Structure do
  use Construct

  structure do
    field :value, Construct.Types.UUID
  end
end

> Structure.make!(value: "fd4ddf80-a7d9-4af8-b46c-26fc4566d92c")
%Structure{value: "fd4ddf80-a7d9-4af8-b46c-26fc4566d92c"}

> Structure.make(value: "invalid")
{:error, %{value: :invalid}}

Link to this section Summary

Functions

Casts the given input to the custom type

Link to this section Functions

Casts the given input to the custom type.

Callback implementation for Construct.Type.cast/1.