mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 21:13:10 +12:00
fix: optimize filter expr traversal
This commit is contained in:
parent
a86ef00521
commit
5a6583a019
1 changed files with 10 additions and 6 deletions
|
@ -1166,12 +1166,6 @@ defmodule Ash.Filter do
|
|||
value when is_list(value) ->
|
||||
Enum.map(value, &map(&1, func))
|
||||
|
||||
value when is_map(value) ->
|
||||
value
|
||||
|> Map.to_list()
|
||||
|> map(func)
|
||||
|> Map.new()
|
||||
|
||||
%BooleanExpression{left: left, right: right} = expr ->
|
||||
%{expr | left: map(left, func), right: map(right, func)}
|
||||
|
||||
|
@ -1210,6 +1204,16 @@ defmodule Ash.Filter do
|
|||
end)
|
||||
}
|
||||
|
||||
%Ash.Query.Ref{} = expr ->
|
||||
# you have to map over the internals of exists yourself
|
||||
func.(expr)
|
||||
|
||||
value when is_map(value) ->
|
||||
value
|
||||
|> Map.to_list()
|
||||
|> map(func)
|
||||
|> Map.new()
|
||||
|
||||
other ->
|
||||
func.(other)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue