# `Arex.Query`
[🔗](https://github.com/m/exarcade/blob/v0.1.0/lib/arex/query.ex#L1)

Read-oriented query helpers.

`Arex.Query` is the lowest-friction way to execute read statements without
dropping all the way to `Arex.Http`. It keeps option resolution, normalized
error handling, and paging behavior aligned with the rest of the library.

Use `sql/3` for ordinary ArcadeDB SQL queries and `run/3` when you want the
query language to come from call options or application config.

`Arex.Query` is statement-oriented. It does not infer record
types or append tenant and scope predicates automatically. If you want
type-aware or boundary-aware CRUD semantics, prefer `Arex.Record`.

# `first`

Returns the first row from a paged query or `nil` when the query is empty.

Internally this delegates to `page/3` with `limit: 1`.

# `one`

Returns exactly one row or `nil`.

When the query returns more than one row, the function fails with a normalized
`:multiple_results` error.

# `page`

Returns one page of rows using ArcadeDB `skip` and `limit` semantics.

The returned map contains `:entries`, `:limit`, `:offset`, `:count`, and
`:has_more?`. Arex fetches one extra row internally so it can answer the
`has_more?` question without requiring a separate count query.

# `run`

Executes a raw query using the resolved query language.

`language` comes from call options, application config, or the default
`"sql"`. This helper is useful when you want `Arex` to honor the resolved
language instead of forcing SQL.

# `sql`

Executes a SQL query.

This helper always forces `language: "sql"` regardless of any configured
default language.

# `stream_pages`

Streams query pages until there are no more rows.

The stream yields `{:ok, page_map}` tuples and stops at the first error,
which is yielded as `{:error, error_map}`.

---

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