Behaviour implemented by database adapter packages.
Adapters build validation targets, run checks, and execute database-specific introspection queries for checks.
Summary
Types
Adapter-specific query execution option.
Adapter-specific query execution options.
Raw database query result returned by an adapter.
Adapter-specific target construction option.
Adapter-specific target construction options.
Callbacks
Executes database-specific introspection SQL for target.
Builds a single validation target from adapter-specific options.
Runs checks against a non-empty list of targets.
Types
Adapter-specific query execution option.
@type query_opts() :: [query_opt()]
Adapter-specific query execution options.
@type query_result() :: term()
Raw database query result returned by an adapter.
Adapter-specific target construction option.
@type target_opts() :: [target_opt()]
Adapter-specific target construction options.
Callbacks
@callback query( target :: Bylaw.Db.Target.t(), sql :: String.t(), params :: [term()], opts :: query_opts() ) :: {:ok, query_result()} | {:error, term()}
Executes database-specific introspection SQL for target.
Checks call this callback through the target's adapter when they need database metadata.
@callback target(opts :: target_opts()) :: Bylaw.Db.Target.t()
Builds a single validation target from adapter-specific options.
@callback validate(targets :: [Bylaw.Db.Target.t()], checks :: [Bylaw.Db.check_spec()]) :: Bylaw.Db.Check.result()
Runs checks against a non-empty list of targets.
Adapter implementations should usually delegate to Bylaw.Db.validate/2.