Queries Chronicle read model instances.
Read models are populated by reducers and projections. Use get/3 to fetch
the current state of a single read model instance by its key, or all/2 to
retrieve all instances.
Usage
{:ok, account} = Chronicle.ReadModels.get(MyApp.ReadModels.Account, "account-1")
{:ok, accounts} = Chronicle.ReadModels.all(MyApp.ReadModels.Account)With explicit client:
{:ok, account} = Chronicle.ReadModels.get(
MyApp.ReadModels.Account,
"account-1",
client: :bank_chronicle
)
Summary
Functions
Returns all instances of the given read model.
Options
:client— the client name (default:Chronicle.Client):namespace— overrides the client's default namespace:event_sequence_id— the event sequence to project from (default:"event-log")
Fetches a read model instance by its key.
Options
:client— the client name (default:Chronicle.Client):namespace— overrides the client's default namespace:event_sequence_id— the event sequence to project from (default:"event-log")
Returns {:ok, model_struct} on success, or {:ok, nil} if not found.