ash_postgres/test/support/string_agg.ex
Zach Daniel e271a27d3c improvement: avg/min/max/custom aggregate support
fix: fix various problems with the model behind aggregates
2022-12-07 20:32:38 -05:00

13 lines
314 B
Elixir

defmodule AshPostgres.Test.StringAgg do
use Ash.Resource.Aggregate.CustomAggregate
use AshPostgres.CustomAggregate
require Ecto.Query
def dynamic(opts, binding) do
Ecto.Query.dynamic(
[],
fragment("string_agg(?, ?)", field(as(^binding), ^opts[:field]), ^opts[:delimiter])
)
end
end