# `Bylaw.Db.Adapters.Postgres`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.1.0-alpha.1/lib/bylaw/db/adapters/postgres.ex#L1)

Postgres database adapter entrypoint.

This adapter validates one Postgres repo per call:

    Bylaw.Db.Adapters.Postgres.validate(
      MyApp.Repo,
      [
        Bylaw.Db.Adapters.Postgres.Checks.MissingForeignKeyIndexes
      ]
    )

Pass `:dynamic_repo` when the call should run against one dynamic repo.
Validate multiple repos by calling `validate/2` or `validate/3` once per repo.

The repo argument expects an Ecto SQL repo at runtime. Bylaw keeps Ecto SQL as
an optional integration; callers must have `ecto_sql` and a Postgres driver in
their application when they use repo-backed targets.

## Examples

    Bylaw.Db.Adapters.Postgres.validate(
      MyApp.Repo,
      [
        Bylaw.Db.Adapters.Postgres.Checks.MissingForeignKeyIndexes
      ]
    )

# `validate_opt`

```elixir
@type validate_opt() :: {:dynamic_repo, atom() | pid() | nil}
```

Option accepted by `validate/3`.

# `validate_opts`

```elixir
@type validate_opts() :: [validate_opt()]
```

Options accepted by `validate/3`.

# `validate`

```elixir
@spec validate(repo :: module(), checks :: [Bylaw.Db.check_spec()]) ::
  Bylaw.Db.Check.result()
```

Runs checks against one Postgres repo.

Pass the repo and checks. Use `:dynamic_repo` when validating a specific
dynamic repo with `validate/3`. To validate multiple repos, call this function
once per repo.

# `validate`

```elixir
@spec validate(
  repo :: module(),
  checks :: [Bylaw.Db.check_spec()],
  opts :: validate_opts()
) ::
  Bylaw.Db.Check.result()
```

Runs checks against one Postgres repo with options.

The only supported option is `:dynamic_repo`.

---

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