Bylaw.Db.Adapters.Postgres (bylaw_postgres v0.1.0-alpha.1)

Copy Markdown View Source

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
  ]
)

Summary

Types

Option accepted by validate/3.

Options accepted by validate/3.

Functions

Runs checks against one Postgres repo.

Runs checks against one Postgres repo with options.

Types

validate_opt()

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

Option accepted by validate/3.

validate_opts()

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

Options accepted by validate/3.

Functions

validate(repo, checks)

@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(repo, checks, opts)

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