# `PgRest.AST.Aggregate`
[🔗](https://github.com/agoodway/pgrest/blob/v0.2.0/lib/pg_rest/ast.ex#L97)

A `select=` aggregate: `count()`, `col.sum()`, `alias:col::text.avg()::int`.

`field` is `nil` for a bare `count()`. `input_cast` is the cast applied to the
column before aggregating, `cast` the cast applied to the result.

# `fun`

```elixir
@type fun() :: :count | :sum | :avg | :min | :max
```

# `t`

```elixir
@type t() :: %PgRest.AST.Aggregate{
  alias: String.t() | nil,
  cast: String.t() | nil,
  field: PgRest.AST.Field.t() | nil,
  fun: fun(),
  input_cast: String.t() | nil
}
```

---

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