module Rotor::Joins

The translation of joins: a for comprehension's inner queries (Rotor::Query#flat_map) and associations (Rotor::Query#join).

/home/runner/work/rotor/rotor/src/join.qz:14

Class methods

def self.plan(sources: Array[Rotor::Source], expr: Meta::Expr, captures: Array[Object], file: String, site: Int) -> Rotor::Plan

The plan of flat_map's block expr over the rows of sources: the outer tables fetched with the columns the whole block reads of their rows (the block runs on them to make each result), then the tables of its query. The translation is kept (Rotor::Cache) by the block's site.

/home/runner/work/rotor/rotor/src/join.qz:20

def self.fetching(s: Rotor::Source, reads: Array[Rotor::Column]?) -> Rotor::Source

s fetching the columns reads (and those it keeps), or all of them for nil.

/home/runner/work/rotor/rotor/src/join.qz:34

def self.association(t: Rotor::Translator, e: Meta::Expr, i: Int, source: Rotor::Source) -> [Rotor::Association, Symbol]

The has_many association whose getter e calls on the row of table i (source), and that table's primary key.

/home/runner/work/rotor/rotor/src/join.qz:41

def self.key_condition(t: Int, fk: Symbol, s: Int, key: Symbol) -> Rotor::Sql

"t".fk = "s".key: an association's join.

/home/runner/work/rotor/rotor/src/join.qz:59

def self.load[R <: Rotor::Model](target: Type[R], f: Rotor::Fetched) -> R

A target from the values a row gave of its table.

/home/runner/work/rotor/rotor/src/join.qz:64