Durable.Query (Durable v0.1.0-rc)
View SourceQuery functions for workflow executions.
Summary
Functions
Returns a %{parent_workflow_id => child_count} map for the given parent
ids, in a single query. Used to render a "N children" drill-down affordance
on top-level run rows without an N+1. Parents with no children are omitted.
Counts workflow executions matching filters.
Returns workflow execution counts grouped by status.
Gets a workflow execution by ID.
Gets step executions for a workflow.
Gets logs for a specific step.
Lists child workflow executions for a parent workflow.
Lists workflow executions with optional filters.
Lists workflow executions with total count for pagination.
Lists distinct workflow definitions, derived from execution history.
Functions
@spec child_counts( [String.t()], keyword() ) :: %{required(String.t()) => non_neg_integer()}
Returns a %{parent_workflow_id => child_count} map for the given parent
ids, in a single query. Used to render a "N children" drill-down affordance
on top-level run rows without an N+1. Parents with no children are omitted.
Options
:durable- The Durable instance name (default: Durable)
@spec count_executions(keyword()) :: non_neg_integer()
Counts workflow executions matching filters.
@spec dashboard_counts(keyword()) :: %{required(atom()) => non_neg_integer()}
Returns workflow execution counts grouped by status.
Returns a map like %{pending: 5, running: 3, completed: 100, ...}.
Options
:durable- The Durable instance name (default: Durable)
Gets a workflow execution by ID.
Options
:include_steps- Include step executions (default: false):include_logs- Include logs in step executions (default: false):durable- The Durable instance name (default: Durable)
Gets step executions for a workflow.
@spec get_step_logs(String.t(), atom() | String.t(), keyword()) :: {:ok, [map()]} | {:error, :not_found}
Gets logs for a specific step.
Lists child workflow executions for a parent workflow.
Options
:status- Filter by status:durable- The Durable instance name (default: Durable)
Lists workflow executions with optional filters.
Filters
:workflow- Filter by workflow module:workflow_name- Filter by workflow name:status- Filter by status:queue- Filter by queue:limit- Maximum results (default: 50):offset- Offset for pagination (default: 0):durable- The Durable instance name (default: Durable)
@spec list_executions_with_total(keyword()) :: {[map()], non_neg_integer()}
Lists workflow executions with total count for pagination.
Returns {executions, total_count}.
Accepts the same filters as list_executions/1.
Lists distinct workflow definitions, derived from execution history.
Returns one row per {workflow_module, workflow_name} pair that has
ever been executed, with aggregate stats. There is no compile-time
registry of definitions in the engine — the executor only resolves
modules by name on demand — so the dashboard derives the catalog from
the persisted executions.
Each row contains:
:workflow_module(string):workflow_name(string):total_runs(non_neg_integer):running_count(non_neg_integer):waiting_count(non_neg_integer):failed_count(non_neg_integer):last_run_at(DateTime.t() | nil) — most recent inserted_at:last_status(atom | nil) — status of the most recent run
Sorted by last_run_at DESC NULLS LAST.
Options
:durable- The Durable instance name (default: Durable)