mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: Enum types only have storage_type/0
still
This commit is contained in:
parent
b51dbe49c9
commit
50164049df
2 changed files with 5 additions and 2 deletions
|
@ -46,7 +46,7 @@ defmodule Ash.Type.Enum do
|
||||||
def values, do: @values
|
def values, do: @values
|
||||||
|
|
||||||
@impl Ash.Type
|
@impl Ash.Type
|
||||||
def storage_type(_), do: :string
|
def storage_type, do: :string
|
||||||
|
|
||||||
@impl Ash.Type
|
@impl Ash.Type
|
||||||
def generator(_constraints) do
|
def generator(_constraints) do
|
||||||
|
@ -120,7 +120,7 @@ defmodule Ash.Type.Enum do
|
||||||
:error
|
:error
|
||||||
end
|
end
|
||||||
|
|
||||||
defoverridable storage_type: 1
|
defoverridable storage_type: 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -147,6 +147,7 @@ defmodule Ash.Type do
|
||||||
authorize?: boolean | nil
|
authorize?: boolean | nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@callback storage_type() :: Ecto.Type.t()
|
||||||
@callback storage_type(constraints) :: Ecto.Type.t()
|
@callback storage_type(constraints) :: Ecto.Type.t()
|
||||||
@doc """
|
@doc """
|
||||||
Useful for typed data layers (like ash_postgres) to instruct them not to attempt to cast input values.
|
Useful for typed data layers (like ash_postgres) to instruct them not to attempt to cast input values.
|
||||||
|
@ -203,6 +204,7 @@ defmodule Ash.Type do
|
||||||
{:ok, list(term)} | {:error, Ash.Error.t()}
|
{:ok, list(term)} | {:error, Ash.Error.t()}
|
||||||
|
|
||||||
@optional_callbacks [
|
@optional_callbacks [
|
||||||
|
storage_type: 0,
|
||||||
cast_stored_array: 2,
|
cast_stored_array: 2,
|
||||||
generator: 1,
|
generator: 1,
|
||||||
cast_input_array: 2,
|
cast_input_array: 2,
|
||||||
|
@ -1111,6 +1113,7 @@ defmodule Ash.Type do
|
||||||
raise "Must only define storage_type/0 or storage_type/1 but not both"
|
raise "Must only define storage_type/0 or storage_type/1 but not both"
|
||||||
|
|
||||||
Module.defines?(__MODULE__, {:storage_type, 0}) ->
|
Module.defines?(__MODULE__, {:storage_type, 0}) ->
|
||||||
|
@impl Ash.Type
|
||||||
def storage_type(_constraints), do: storage_type()
|
def storage_type(_constraints), do: storage_type()
|
||||||
|
|
||||||
true ->
|
true ->
|
||||||
|
|
Loading…
Reference in a new issue