mirror of
https://github.com/sloanelybutsurely/typeid-elixir.git
synced 2024-11-28 09:52:53 -05:00
better support for default type
This commit is contained in:
parent
e9b3dc1691
commit
262f47cd6c
1 changed files with 6 additions and 0 deletions
|
@ -110,6 +110,10 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
|
|||
nil ->
|
||||
opts
|
||||
|> Keyword.get(:type, default_type)
|
||||
|> case do
|
||||
TypeID -> default_type
|
||||
type -> type
|
||||
end
|
||||
|> validate_type!()
|
||||
|
||||
type ->
|
||||
|
@ -118,6 +122,7 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
|
|||
end
|
||||
|
||||
defp validate_opts!(opts) do
|
||||
IO.inspect(opts)
|
||||
primary_key = Keyword.get(opts, :primary_key, false)
|
||||
schema = Keyword.fetch!(opts, :schema)
|
||||
field = Keyword.fetch!(opts, :field)
|
||||
|
@ -133,6 +138,7 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
|
|||
else
|
||||
%{schema: schema, field: field, type: type, prefix: prefix}
|
||||
end
|
||||
|> IO.inspect()
|
||||
end
|
||||
|
||||
defp find_prefix(%{prefix: prefix}) when not is_nil(prefix), do: prefix
|
||||
|
|
Loading…
Reference in a new issue