# `AshScylla.Repo`
[🔗](https://github.com/ohhi-vn/ash_scylla/blob/main/lib/ash_scylla/repo.ex#L15)

Configuration module for AshScylla using direct Xandra connections.

## Usage

    defmodule MyApp.Repo do
      use AshScylla.Repo,
        otp_app: :my_app
    end

Then configure it in config/config.exs:

    config :my_app, MyApp.Repo,
      nodes: ["127.0.0.1:9042"],
      keyspace: "my_app_dev"

## Adding to your supervision tree

    children = [
      MyApp.Repo,
      # ...
    ]

## Options

- `:nodes` - List of ScyllaDB/Cassandra nodes to connect to
- `:keyspace` - The keyspace to use
- `:connect_timeout` - TCP connection timeout in ms (default: 5000)
- `:disable_lwt?` - Disable lightweight transactions even when resource config enables them (default: false)
- `:disable_atomic_actions?` - Disable atomic action support (default: false)
- `:installed_extensions` - List of installed ScyllaDB extensions (e.g. `[:lwt]`)

# `config`

```elixir
@type config() :: keyword()
```

# `child_spec`

```elixir
@callback child_spec(keyword()) :: Supervisor.child_spec()
```

# `config`

```elixir
@callback config() :: keyword()
```

# `connection`

```elixir
@callback connection() :: AshScylla.Connection.t() | nil
```

# `create_keyspace`

```elixir
@callback create_keyspace(
  String.t() | nil,
  keyword()
) :: {:ok, term()} | {:error, term()}
```

# `disable_atomic_actions?`

```elixir
@callback disable_atomic_actions?() :: boolean()
```

# `disable_lwt?`

```elixir
@callback disable_lwt?() :: boolean()
```

# `drop_keyspace`

```elixir
@callback drop_keyspace(String.t() | nil) :: {:ok, term()} | {:error, term()}
```

# `installed_extensions`

```elixir
@callback installed_extensions() :: [atom()]
```

# `keyspace`

```elixir
@callback keyspace() :: String.t() | nil
```

# `nodes`

```elixir
@callback nodes() :: [String.t()]
```

# `prepare`

```elixir
@callback prepare(
  String.t(),
  keyword()
) :: {:ok, Xandra.Prepared.t()} | {:error, term()}
```

# `prepare!`

```elixir
@callback prepare!(
  String.t(),
  keyword()
) :: Xandra.Prepared.t() | no_return()
```

# `query`

```elixir
@callback query(String.t(), list(), keyword()) :: {:ok, term()} | {:error, term()}
```

# `query!`

```elixir
@callback query!(String.t(), list(), keyword()) :: term() | no_return()
```

# `config_to_conn_opts`

```elixir
@spec config_to_conn_opts(module()) :: keyword()
```

Converts repo config to Xandra connection options.

---

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