Behaviour for checks that validate an Ecto.Query before it runs.
Every built-in check implements this callback contract. End users should
usually call Bylaw.Ecto.Query.validate/3 with an explicit check list instead
of calling check modules directly.
Summary
Types
The Ecto query operation being prepared.
Check-specific options passed to the check.
The query being validated before the repo runs it.
The result returned by a query check.
Callbacks
Validates a prepared Ecto query for one check.
Types
@type operation() :: :all | :update_all | :delete_all | :stream | :insert_all
The Ecto query operation being prepared.
Ecto calls Ecto.Repo.prepare_query/3 with these operations. Query helpers
such as Repo.one/2, Repo.get/3, and Repo.exists?/2 are prepared as
:all.
Check-specific options passed to the check.
@type query() :: Ecto.Query.t()
The query being validated before the repo runs it.
@type result() :: :ok | {:error, [Bylaw.Ecto.Query.Issue.t(), ...]}
The result returned by a query check.
:ok means the query passed the check. {:error, issues} reports one or
more query issues.