Repository navigation
feat(database): runOne, runOption and runNonEmpty cardinality helpers - #92
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Cardinality error and query helpers src/database/errors.ts, src/database/database.ts |
Adds ResultCardinalityError with the expected cardinality and actual row count. Adds helpers that return a single row, an optional row, or a non-empty row array according to their cardinality rules. |
Public exports and helper validation src/database.ts, src/database/database.test-d.ts, src/database/database.test.ts, docs/database.md, docs/reference.md, docs/troubleshooting.md, .changeset/cardinality-helpers.md |
Re-exports the helpers and error. Tests check result types, cardinality outcomes, and that runOne does not add a LIMIT. Documentation describes the helpers and their error behavior. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Possibly related PRs
- MapleTechLabs/effect-orm#8: Adds the
Database.runAPI that the cardinality helpers call. - MapleTechLabs/effect-orm#27: Changes the
Runnablecontract used by the new helpers. - MapleTechLabs/effect-orm#19: Changes the accepted insert types in
Database.Runnable, which the helpers use.
Suggested reviewers: makisuo
Merge Risk: 
Minimal · up to 0315f
-
The new helpers add row-count validation. No merge-blocking issue was identified.
Pre-merge checks: 
4
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
Fix failing CI checks
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
f602dad to
0315f9e
Compare
|
Merge-readiness check: this branch already contains current main (b57faf1), so no merge or code changes were needed. The changeset is present. The helpers only post-process CI run 40664791388 failed only on known fuzz flakes on main, which are fixed separately in #131:
None of these involve this change. The failed jobs have been re-run. Verified locally on 0315f9e: |
Maple review🟢 Confidence 10/10 · safe to merge. Purely additive post-processing over Adds
|
Summary by CodeRabbit
Closes #69