module

Prostore::Query::Analyzer

Static analysis of named queries (ADR-0006).

Walks each Schema::Query's call chain — captured at macro time as Schema::Call records — and classifies every field reference:

:filtered — appears in where(field: ...) :sorted — appears in order_by(:field, ...) / order_by(field, ...) :grouped — appears in group_by(...) (reserved)

The analyzer drives two ADR-0006 outcomes:

  1. Required-index check. Every (filtered or sorted) field on a query must be covered by a declared index in the model. ADR-0006 strict-mode makes this a hard error.

  2. Lazy override. A lazy: field that's referenced non- projectionally (filtered/sorted/joined) cannot remain lazy; the planner must materialize it eagerly. The override is reported and the field is treated as if lazy: were absent for index planning.

Instance methods

analyze(definition : Schema::Definition) : Report
Source
analyze_query(q : Schema::Query) : Usage

Per-query classification.

Source
validate_indexes!(definition : Schema::Definition, report : Report = analyze(definition)) : Nil

Required-index check (ADR-0006). Raises Prostore::SchemaError if a filtered or sorted field on any named query lacks index coverage.

Composite-index covering rule: a field is covered by an index if it appears at position N of that index's column list AND every column at positions [0, N) of that same index is also filtered in the same query (the standard left-prefix rule). The leading column (N=0) is always covered if the field is filtered or sorted at all.

The primary key is treated as a single-column index covering the PK.

Source

Nested types