Skip to content

Add SelectFourMany with consolidate() for star topology (#3054)#3088

Merged
tyt2y3 merged 3 commits into
masterfrom
staging/pr-3054-select-four-many
Jun 18, 2026
Merged

Add SelectFourMany with consolidate() for star topology (#3054)#3088
tyt2y3 merged 3 commits into
masterfrom
staging/pr-3054-select-four-many

Conversation

@tyt2y3

@tyt2y3 tyt2y3 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Staging PR for #3054 (preserves @TonySchneider's authorship + merged status per our branch policy for external contributions).

@TonySchneider's feature (merged into this branch)

Adds SelectFourMany<E, F, G, H, TOP>, SelectFour::consolidate(), and SelectFourMany<TopologyStar>::all() — mirroring SelectThreeMany — so a parent fetched with three has-many children in one query consolidates into Vec<(E::Model, Vec<F::Model>, Vec<G::Model>, Vec<H::Model>)> instead of flat Option tuples. Reuses retain_unique_models / ModelKey; star topology only (chain/tee can follow). Purely additive.

Staging work (this branch)

  • Reviewed against the SelectThreeMany/tee patterns: consolidation logic is faithful (correct first-occurrence ordering, childless-parent handling, per-child dedup). SelectFour is only ever TopologyStar (sole constructor is SelectThree::find_also), so the Star-only all() covers every reachable case; SelectFourMany is exported via pub use select::*.
  • Added a runtime test (tests/select_four_many_tests.rs): builds a 4-way star (center -> a, b, c), runs find_also_related ×2 → find_also → consolidate().all(), and checks the a×b×c cross product consolidates back to one tuple per parent. Uses order_by_asc on each child for deterministic order (matches the existing SelectThree consolidate test). Verified on SQLite, PostgreSQL, and rusqlite (sync).
  • Regenerated sea-orm-sync (the PR only touched src/).

@tyt2y3 tyt2y3 merged commit 08bb166 into master Jun 18, 2026
77 of 78 checks passed
@tyt2y3 tyt2y3 deleted the staging/pr-3054-select-four-many branch June 18, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants