mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: fix aggregate.uniq?
This commit is contained in:
parent
e6c51433d0
commit
732728236e
3 changed files with 14 additions and 6 deletions
|
@ -2363,7 +2363,8 @@ defmodule Ash.Filter do
|
|||
filterable?: aggregate.filterable?,
|
||||
type: aggregate.type,
|
||||
constraints: aggregate.constraints,
|
||||
implementation: aggregate.implementation
|
||||
implementation: aggregate.implementation,
|
||||
uniq?: aggregate.uniq?
|
||||
) do
|
||||
case parse_predicates(nested_statement, query_aggregate, context) do
|
||||
{:ok, nested_statement} ->
|
||||
|
@ -2892,7 +2893,8 @@ defmodule Ash.Filter do
|
|||
filterable?: aggregate.filterable?,
|
||||
type: aggregate.type,
|
||||
constraints: aggregate.constraints,
|
||||
implementation: aggregate.implementation
|
||||
implementation: aggregate.implementation,
|
||||
uniq?: aggregate.uniq?
|
||||
) do
|
||||
{:ok, %{ref | attribute: query_aggregate, resource: related}}
|
||||
else
|
||||
|
|
|
@ -936,7 +936,8 @@ defmodule Ash.Query do
|
|||
filterable?: aggregate.filterable?,
|
||||
type: aggregate.type,
|
||||
constraints: aggregate.constraints,
|
||||
implementation: aggregate.implementation
|
||||
implementation: aggregate.implementation,
|
||||
uniq?: aggregate.uniq?
|
||||
) do
|
||||
query_aggregate = %{query_aggregate | load: field}
|
||||
new_aggregates = Map.put(query.aggregates, aggregate.name, query_aggregate)
|
||||
|
@ -1492,7 +1493,8 @@ defmodule Ash.Query do
|
|||
Keyword.get(opts, :filterable?, true),
|
||||
opts[:type],
|
||||
Keyword.get(opts, :constraints, []),
|
||||
opts[:implementation]
|
||||
opts[:implementation],
|
||||
opts[:uniq?]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -1511,6 +1513,7 @@ defmodule Ash.Query do
|
|||
atom | list(atom),
|
||||
Ash.Query.t() | Keyword.t() | nil
|
||||
) :: t()
|
||||
@deprecated "use `aggregate/5` instead"
|
||||
def aggregate(
|
||||
query,
|
||||
name,
|
||||
|
@ -1521,7 +1524,8 @@ defmodule Ash.Query do
|
|||
filterable? \\ true,
|
||||
type \\ nil,
|
||||
constraints \\ [],
|
||||
implementation \\ nil
|
||||
implementation \\ nil,
|
||||
uniq? \\ false
|
||||
) do
|
||||
{field, agg_query} =
|
||||
case agg_query do
|
||||
|
@ -1568,7 +1572,8 @@ defmodule Ash.Query do
|
|||
filterable?: filterable?,
|
||||
type: type,
|
||||
constraints: constraints,
|
||||
implementation: implementation
|
||||
implementation: implementation,
|
||||
uniq?: uniq?
|
||||
) do
|
||||
{:ok, aggregate} ->
|
||||
new_aggregates = Map.put(query.aggregates, aggregate.name, aggregate)
|
||||
|
|
|
@ -14,6 +14,7 @@ defmodule Ash.Resource.Aggregate do
|
|||
:field,
|
||||
:sort,
|
||||
:default,
|
||||
:uniq?,
|
||||
filterable?: true
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in a new issue