# `AshPostgres.CustomAggregate`
[🔗](https://github.com/ash-project/ash_postgres/blob/v2.9.0/lib/custom_aggregate.ex#L5)

A custom aggregate implementation for ecto.

# `dynamic`

```elixir
@callback dynamic(opts :: Keyword.t(), binding :: integer()) :: Ecto.Query.dynamic_expr()
```

The dynamic expression to create the aggregate.

The binding refers to the resource being aggregated,
use `as(^binding)` to reference it.

For example:

    Ecto.Query.dynamic(
      [],
      fragment("string_agg(?, ?)", field(as(^binding), ^opts[:field]), ^opts[:delimiter])
    )

---

*Consult [api-reference.md](api-reference.md) for complete listing*
