Bylaw.Db (bylaw_db v0.1.0-alpha.1)

Copy Markdown View Source

Runs database validation checks against explicit targets.

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

Examples

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

Summary

Types

A check module with optional check-specific options.

Functions

Runs checks against a non-empty list of targets.

Types

check_spec()

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

A check module with optional check-specific options.

Functions

validate(targets, checks)

@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 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