mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: use ecto's uuid type under the hood
This commit is contained in:
parent
49039a1759
commit
f1a6fb7418
1 changed files with 5 additions and 5 deletions
|
@ -8,24 +8,24 @@ defmodule Ash.Type.UUID do
|
||||||
use Ash.Type
|
use Ash.Type
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def storage_type, do: :binary_id
|
def storage_type, do: Ecto.UUID
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def cast_input(value, _) when is_binary(value) do
|
def cast_input(value, _) when is_binary(value) do
|
||||||
Ecto.Type.cast(:binary_id, String.trim(value))
|
Ecto.Type.cast(Ecto.UUID, String.trim(value))
|
||||||
end
|
end
|
||||||
|
|
||||||
def cast_input(value, _) do
|
def cast_input(value, _) do
|
||||||
Ecto.Type.cast(:binary_id, value)
|
Ecto.Type.cast(Ecto.UUID, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def cast_stored(value, _) do
|
def cast_stored(value, _) do
|
||||||
Ecto.Type.load(:binary_id, value)
|
Ecto.Type.load(Ecto.UUID, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def dump_to_native(value, _) do
|
def dump_to_native(value, _) do
|
||||||
Ecto.Type.dump(:binary_id, value)
|
Ecto.Type.dump(Ecto.UUID, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue