Continuum.Query (continuum v0.5.0)

Copy Markdown View Source

Structured read API for durable run rows.

Queries are intentionally closed over a small set of fields and operators. This keeps the public API independent from arbitrary SQL fragments while still supporting operator dashboards and search attributes.

Summary

Functions

Loads one run by id.

Lists runs matching a structured query.

Merges search attributes into a run row.

Types

attribute_path()

@type attribute_path() :: [atom() | binary()]

condition()

@type condition() ::
  {:eq | :neq | :lt | :lte | :gt | :gte, field(), term()}
  | {:eq | :neq, attribute_path(), term()}
  | {:in, field(), [term()]}

field()

@type field() :: :id | :run_id | :state | :workflow | :started_at | :completed_at

Functions

get_run(run_id, opts \\ [])

@spec get_run(
  binary(),
  keyword()
) :: {:ok, map()} | {:error, :not_found | term()}

Loads one run by id.

list(opts \\ [])

@spec list(keyword()) :: {:ok, map()} | {:error, term()}

Lists runs matching a structured query.

Options:

  • :instance - Continuum instance name or struct. Defaults to Continuum.
  • :namespace - run namespace. Defaults to "default".
  • :where - list of condition tuples.
  • :search - run id or workflow substring convenience filter.
  • :workflow - workflow substring convenience filter.
  • :state - run state convenience filter.
  • :order_by - {direction, field}. Defaults to {:desc, :started_at}.
  • :page and :per_page - 1-based pagination; :per_page caps at 100.

set_attributes(run_id, attributes, opts \\ [])

@spec set_attributes(binary(), map(), keyword()) :: :ok | {:error, term()}

Merges search attributes into a run row.

Attributes must be JSON-encodable map data. This updates metadata only; it does not append a journal event.