CommandedAggregateless. Query behaviour
(commanded_aggregateless v1.0.0)
Copy Markdown
Provides common functionality for the execution of queries against the read store
Example:
defmodule CommandedAggregateless.TestQuery do
use CommandedAggregateless.Query, repo: CommandedAggregateless.ReadOnlyRepo, repo_fn: :all
inputs do
field :foo, :string
end
validates(:foo, string: true)
def to_query(_query) do
from t in TestProjection, select: t
end
end
Summary
Callbacks
Callback that allows a query to manipulate the results before they are returned.
Functions
Sets up a query module for use with the CommandedAggregateless.Query.QueryOps protocol.
Executes the query against the read store.
Defines the inputs to the query.
Types
@type error() :: validation_error()
@type repo_fn_result() :: term() | nil | [Ecto.Schema.t() | term()] | boolean() | Ecto.Schema.t() | Enum.t()
@type result() :: CommandedAggregateless.result(repo_fn_result(), validation_error())
@type result(type) :: CommandedAggregateless.result(type, validation_error())
@type t() :: CommandedAggregateless.Query.QueryOps.t()
Callbacks
Callback that allows a query to manipulate the results before they are returned.
A default implementation that simply returns the result unchanged is provided when
using use CommandedAggregateless.Query.
@callback to_query(t()) :: Ecto.Query.t()
Functions
Sets up a query module for use with the CommandedAggregateless.Query.QueryOps protocol.
See module documentation for an example.
@spec execute(CommandedAggregateless.Query.QueryOps.t()) :: result()
Executes the query against the read store.
Defines the inputs to the query.
See module documentation for an example.