Prostore::Query::Builder(T)
Chainable query builder. Each chained call returns a new builder with
one extra clause; the original is unchanged. Materialization happens
via to_a, each, first, count, etc.
Generic over T (the model instance type the builder yields). The
macro query :name, ->(...) { ... } emits a class method that
constructs a Builder(self) and runs the lambda body inside a
with builder block, so where(...), order_by(...) etc. inside
the lambda dispatch to the builder.
Constructors
Instance methods
Inside-block builder for the macro-emitted class methods. The
with builder yield makes naked where(...) etc. inside the
lambda body resolve to instance methods on the builder.
Explicit join with caller-supplied source/target column lists.
FK-resolved join. Looks for a foreign key linking T (the source
model) and target_class. If multiple FKs exist between the two,
fk_tag disambiguates.
Resolution rules:
- FK on the target references the source (e.g.,
User.joins(Order)where Order hasforeign_key … references: User): ON source.pk = target.fk_columns - FK on the source references the target (e.g.,
Order.joins(User)): ON source.fk_columns = target.pk - Neither found → raise
Prostore::Error.
Project only the named columns in the resulting SELECT (ADR-0014). Materialized instances will have only the projected fields populated; other ivars stay nil and accessing a non-projected non-nullable field raises (per the model's standard accessor semantics).