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

Runs database validation checks against explicit targets.

Adapter packages usually expose their own `validate/2` function and delegate
to this module after building `t:Bylaw.Db.Target.t/0` structs.

## Examples

    iex> target = %Bylaw.Db.Target{adapter: MyApp.DbAdapter, meta: %{database: :primary}}
    iex> Bylaw.Db.validate([target], [])
    :ok

# `check_spec`

```elixir
@type check_spec() :: module() | {module(), keyword()}
```

A check module with optional check-specific options.

# `validate`

```elixir
@spec validate(targets :: [Bylaw.Db.Target.t()], checks :: [check_spec()]) ::
  Bylaw.Db.Check.result()
```

Runs `checks` against a non-empty list of targets.

Each check runs independently for each target. Returns `:ok` when every check
passes, or `{:error, issues}` with a non-empty list of
`t:Bylaw.Db.Issue.t/0` values.

Invalid target and check arguments raise `ArgumentError`.

## Examples

    iex> Bylaw.Db.validate([], [])
    ** (ArgumentError) expected at least one database target

---

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