Expand description
Chain relation methods on a Many handle to traverse multi-step
associations without declaring a via relation on the schema.
user.todos().category() produces an Association whose path is two
steps long (User → todos → category). The query engine lowers this by
unfolding into nested IN-subqueries against the outermost relation.
Modules§
- chain_
dedupes_ when_ todos_ share_ category - chain_
from_ empty_ source_ is_ empty - chain_
scopes_ per_ starting_ user - chain_
then_ filter - user_
todos_ category
Functions§
- chain_
skips_ null_ belongs_ to BelongsTo<Option<_>>in the chain skipsNULLforeign keys. Todos with no category contribute nothing to the chain.- four_
step_ chain - A 4-step chain (
Org → Team → Project → Issue → Tag) drives thepeel_first_steploop through three iterations before reducing to a single-step rewrite. Guards against regressions in the depth-independent part of the unfolder. - has_
many_ through_ has_ many - Two HasMany hops in succession (
Author → posts → comments). The lowering unfolds into nested IN-subqueries on eachBelongsTopair. - three_
step_ chain - A 3-step chain (
User → Project → Task → Tag) walks the planner’s unfolder more than once. Verifies the recursive nesting and the chain ofBelongsTorewrites at each hop.