# `PgRest.Planner.Params`
[🔗](https://github.com/agoodway/pgrest/blob/v0.2.0/lib/pg_rest/planner/params.ex#L1)

Splits the query string of a read into per-embed-path groups.

A group is `%{where: [...], order: nil | [OrderTerm], ranges: [{"limit" | "offset", v}],
custom: [{key, value}]}` keyed by the embed path (`[]` is the root). `select`, `order`
(root), the reserved `columns` and `on_conflict`, and keys without a value never become
filters; `limit` and `offset` are collected per path.

# `group`

```elixir
@type group() :: %{
  where: list(),
  order: nil | [PgRest.AST.OrderTerm.t()],
  ranges: [{String.t(), String.t()}],
  custom: [{String.t(), String.t()}]
}
```

# `empty_group`

```elixir
@spec empty_group() :: group()
```

A group with nothing in it.

# `group`

```elixir
@spec group([{String.t(), String.t()}], [String.t()]) ::
  {:ok, %{required([String.t()]) =&gt; group()}} | {:error, PgRest.Error.t()}
```

Groups `params` (valueless keys already dropped) by embed path. `declared` are the
root resource's custom param names.

# `last_value`

```elixir
@spec last_value([{String.t(), String.t()}], String.t()) :: String.t() | nil
```

The last value of `key`, or nil.

# `logic_key?`

```elixir
@spec logic_key?(String.t()) :: boolean()
```

Whether `key` is a logic tree key (`or`, `and`, optionally behind an embed path).

# `not_shaping`

```elixir
@spec not_shaping() :: [String.t()]
```

The reserved parameters that do not shape a representation either (`columns=`, paging).

# `parse_select`

```elixir
@spec parse_select([{String.t(), String.t()}]) ::
  {:ok, [PgRest.AST.Embed.item()]} | {:error, PgRest.Error.t()}
```

Parses the `select` parameter of `params` (valueless keys already dropped): the select tree,
`*` when the request has none.

# `path`

```elixir
@spec path(String.t(), term(), [String.t()]) :: [String.t()]
```

The embed path a query-string parameter targets, parsed with the same grammar as `group/2`:
`[]` for the root (and for a parameter that does not parse, which the planner reports).
`declared` are the custom params. A key that merely contains a dot (`settings->>"a.b"`) is a
root filter: embeddedness comes from the parsed path only.

# `reserved`

```elixir
@spec reserved() :: [String.t()]
```

The query parameters that never filter rows (`PgRest.Write` reads them too).

# `reserved_key?`

```elixir
@spec reserved_key?(String.t()) :: boolean()
```

Whether `key` is never a plain filter or RPC argument: a reserved parameter, a logic key or an
embed-path `order`/`limit`/`offset`.

# `root`

```elixir
@spec root(%{required([String.t()]) =&gt; group()}) :: group()
```

The root group of `groups` (an empty group when the request has no root parameter).

# `root_group`

```elixir
@spec root_group([{String.t(), String.t() | nil}], [String.t()]) ::
  {:ok, group()} | {:error, PgRest.Error.t()}
```

Groups the request parameters `params` (`group/2`, valueless keys dropped) and returns the root
group.

# `string_pairs`

```elixir
@spec string_pairs([{String.t(), String.t() | nil}]) :: [{String.t(), String.t()}]
```

The parameters that carry a value (a valueless key never filters).

---

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