Skip to content

Commit

Permalink
fix: properly gather types for operator & function overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 4, 2024
1 parent d946971 commit f1d5d48
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/types/types.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ defmodule AshPostgres.Types do
Code.ensure_compiled(mod)

name =
if function_exported?(mod, :name, 0) do
mod.name
cond do
function_exported?(mod, :operator, 0) ->
mod.operator()

function_exported?(mod, :name, 0) ->
mod.name()

true ->
nil
end

cond do
Expand All @@ -93,7 +100,7 @@ defmodule AshPostgres.Types do
true ->
[:any]
end
|> Enum.concat(Ash.Query.Operator.operator_overloads(name))
|> Enum.concat(Map.keys(Ash.Query.Operator.operator_overloads(name) || %{}))
|> Enum.map(fn types ->
case types do
:same ->
Expand Down

0 comments on commit f1d5d48

Please sign in to comment.