# `Dllb`
[🔗](https://github.com/Oeditus/dllb_ex/blob/v0.9.0/lib/dllb.ex#L1)

Elixir client for the dllb multi-model NoSQL database.

Provides a high-level API that delegates to a NimblePool-managed
connection pool. Configure the pool in your application config:

    config :dllb,
      enabled: true,
      host: "127.0.0.1",
      port: 3009,
      pool_size: 30,
      outcome: :json,
      timeout: 30_000

## Usage

    {:ok, result} = Dllb.query("SELECT * FROM users")
    result = Dllb.query!("SELECT * FROM users")

# `batch`

```elixir
@spec batch([String.t()], Keyword.t()) :: [ok: Dllb.Result.t(), error: term()]
```

Executes multiple queries in a single pool checkout.

Returns a list of `{:ok, result} | {:error, reason}` in the same
order as the input queries. This is significantly faster for bulk
operations (e.g. AST ingestion) because it amortises the pool
checkout overhead.

# `batch!`

```elixir
@spec batch!([String.t()], Keyword.t()) :: [Dllb.Result.t()]
```

Like `batch/1` but raises on the first error encountered.

Returns a list of result structs on success.

# `batch_transaction`

```elixir
@spec batch_transaction([String.t()], Keyword.t()) ::
  {:ok, Dllb.Result.t()} | {:error, term()}
```

Executes multiple queries inside a `BEGIN BATCH ... END BATCH` block.

All statements run in a single server-side storage transaction,
eliminating per-statement write-commit overhead. Returns a single
result (not a list).

This is dramatically faster than `batch/1` for bulk writes because
the server commits only once instead of once per statement.

# `compact`

```elixir
@spec compact(Keyword.t()) :: {:ok, Dllb.Result.t()} | {:error, term()}
```

Triggers database compaction on the dllb server to reclaim free space.

# `query`

```elixir
@spec query(String.t(), Keyword.t()) :: {:ok, Dllb.Result.t()} | {:error, term()}
```

Executes a query through the connection pool.

Returns `{:ok, result}` or `{:error, reason}`.

# `query!`

```elixir
@spec query!(String.t(), Keyword.t()) :: Dllb.Result.t()
```

Executes a query through the connection pool, raising on error.

Returns the result struct on success or raises `Dllb.Error`.

---

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