# `Adbc.Database`
[🔗](https://github.com/elixir-explorer/adbc/blob/v0.9.0/lib/adbc_database.ex#L1)

Documentation for `Adbc.Database`.

Databases are modelled as processes. They require
a driver to be started.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_binary_option`

```elixir
@spec get_binary_option(pid(), atom() | String.t()) ::
  {:ok, binary()} | {:error, String.t()}
```

Get a binary (bytes) type option of the database.

# `get_float_option`

```elixir
@spec get_float_option(pid(), atom() | String.t()) ::
  {:ok, float()} | {:error, String.t()}
```

Get a float type option of the database.

# `get_integer_option`

```elixir
@spec get_integer_option(pid(), atom() | String.t()) ::
  {:ok, integer()} | {:error, String.t()}
```

Get an integer type option of the database.

# `get_string_option`

```elixir
@spec get_string_option(pid(), atom() | String.t()) ::
  {:ok, String.t()} | {:error, String.t()}
```

Get a string type option of the database.

# `set_option`

```elixir
@spec set_option(
  pid(),
  atom() | String.t(),
  atom() | {:binary, iodata()} | String.t() | number()
) :: :ok | {:error, String.t()}
```

Set option for the database.

- If `value` is an atom or a string, then corresponding string option will be set.
- If `value` is a `{:binary, iodata()}`-tuple, then corresponding binary option will be set.
- If `value` is an integer, then corresponding integer option will be set.
- If `value` is a float, then corresponding float option will be set.

# `start_link`

Starts a database process.

## Options

  * `:driver` (required) - the driver to use for this database.
    It must be an atom (see `Adbc` module documentation for all
    built-in drivers) or a string representing the path to a driver

  * `:process_options` - the options to be given to the underlying
    process. See `GenServer.start_link/3` for all options

All other options are given as database options to the underlying driver.

## Examples

    Adbc.Database.start_link(
      driver: :sqlite,
      process_options: [name: MyApp.DB]
    )

In your supervision tree it would be started like this:

    children = [
      {Adbc.Database,
       driver: :sqlite,
       process_options: [name: MyApp.DB]},
    ]

---

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