ash_postgres/test/support/string_agg.ex

15 lines
333 B
Elixir
Raw Normal View History

defmodule AshPostgres.Test.StringAgg do
@moduledoc false
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