mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +12:00
improvement: handle non-cast-in-type queries
This commit is contained in:
parent
de2817dfa1
commit
c570d5f60e
2 changed files with 11 additions and 2 deletions
|
@ -59,7 +59,12 @@ defmodule AshPostgres.Calculation do
|
||||||
type
|
type
|
||||||
)
|
)
|
||||||
|
|
||||||
expr = Ecto.Query.dynamic(type(^expr, ^type))
|
expr =
|
||||||
|
if type do
|
||||||
|
Ecto.Query.dynamic(type(^expr, ^type))
|
||||||
|
else
|
||||||
|
expr
|
||||||
|
end
|
||||||
|
|
||||||
{calculation.load, calculation.name, expr}
|
{calculation.load, calculation.name, expr}
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -964,7 +964,11 @@ defmodule AshPostgres.Expr do
|
||||||
arg1 = maybe_uuid_to_binary(arg2, arg1, arg1)
|
arg1 = maybe_uuid_to_binary(arg2, arg1, arg1)
|
||||||
type = AshPostgres.Types.parameterized_type(arg2, constraints)
|
type = AshPostgres.Types.parameterized_type(arg2, constraints)
|
||||||
|
|
||||||
Ecto.Query.dynamic(type(^do_dynamic_expr(query, arg1, bindings, embedded?, type), ^type))
|
if type do
|
||||||
|
Ecto.Query.dynamic(type(^do_dynamic_expr(query, arg1, bindings, embedded?, type), ^type))
|
||||||
|
else
|
||||||
|
do_dynamic_expr(query, arg1, bindings, embedded?, type)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_dynamic_expr(
|
defp do_dynamic_expr(
|
||||||
|
|
Loading…
Reference in a new issue