# `AshClickhouse.Query`
[🔗](https://github.com/ohhi-vn/ash_clickhouse/blob/main/lib/ash_clickhouse/query.ex#L1)

Represents a pending ClickHouse query built from Ash query expressions.

The struct is passed through the query pipeline and converted to SQL at
execution time. `AshClickhouse.DataLayer` and
`AshClickhouse.DataLayer.QueryBuilder` operate on `%AshClickhouse.Query{}`.

# `t`

```elixir
@type t() :: %AshClickhouse.Query{
  aggregates: [map()],
  context: map(),
  database: String.t() | nil,
  distinct: [atom()] | nil,
  filters: list(),
  group_by: [atom()] | nil,
  limit: pos_integer() | nil,
  offset: non_neg_integer() | nil,
  repo: module() | nil,
  resource: Ash.Resource.t(),
  select: [atom()] | nil,
  sorts: list(),
  table: String.t() | nil,
  tenant: term()
}
```

# `new`

```elixir
@spec new(module()) :: t()
```

Creates a new query from just a resource (repo resolved from DSL).

# `new`

```elixir
@spec new(module(), module()) :: t()
```

Creates a new query from a resource and repo.

---

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