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

Copy Markdown View Source

Behaviour implemented by database validation checks.

A check receives one Bylaw.Db.Target.t/0 and any check-specific options. Scope such as schemas, tables, or indexes belongs in the check options.

Summary

Types

Check-specific option.

Check-specific options.

The result returned by a database check.

Callbacks

Validates one database target.

Types

check_opt()

@type check_opt() :: {atom(), term()}

Check-specific option.

check_opts()

@type check_opts() :: [check_opt()]

Check-specific options.

result()

@type result() :: :ok | {:error, [Bylaw.Db.Issue.t()]}

The result returned by a database check.

Callbacks

validate(target, opts)

@callback validate(target :: Bylaw.Db.Target.t(), opts :: check_opts()) :: result()

Validates one database target.

Return :ok when the target passes, or {:error, issues} with a non-empty list of Bylaw.Db.Issue.t/0 values when it fails.