Skip to content

Add recursive CTE queries for TOC ancestor path and leaf descent#55

Closed
kdroidFilter wants to merge 1 commit intomasterfrom
feat/recursive-cte-toc-queries
Closed

Add recursive CTE queries for TOC ancestor path and leaf descent#55
kdroidFilter wants to merge 1 commit intomasterfrom
feat/recursive-cte-toc-queries

Conversation

@kdroidFilter
Copy link
Owner

Summary

  • Add selectAncestorPath CTE query to retrieve the full ancestor chain of a TOC entry in a single query (replaces N×getTocEntry() loop)
  • Add selectFirstLeafUnder CTE query to find the first leaf entry under a TOC node in a single query (replaces N×getTocChildren() recursion)
  • Add getAncestorPath() and getFirstLeafTocId() methods to SeforimRepository
  • Add getAncestorPath() to LineSelectionRepository interface
  • Add SelectAncestorPath.toModel() extension

Test plan

  • Verify selectAncestorPath returns correct root-to-leaf path for deeply nested TOC entries
  • Verify selectFirstLeafUnder returns the correct first leaf for nodes with varying depth
  • Verify existing TOC navigation and breadcrumb behavior is unchanged
  • Run :SeforimLibrary:dao:compileKotlinJvm — confirms SQLDelight generation + DAO compilation

Add selectAncestorPath and selectFirstLeafUnder CTE queries to replace
N-query loops for building TOC paths to root and finding first leaf entries.

- Add getAncestorPath() and getFirstLeafTocId() methods to SeforimRepository
- Add getAncestorPath() to LineSelectionRepository interface
- Add SelectAncestorPath.toModel() extension for TocEntry conversion
@kdroidFilter kdroidFilter deleted the feat/recursive-cte-toc-queries branch March 3, 2026 05:03
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.

1 participant