feat: every builder that emits SQL can be compiled - #193
Merged
Merged
Conversation
Six could produce SQL and not a compiled query, so their callers were left
on the path that runs the whole pipeline per request — including
`insertInto(...).returning(...)`, which is the shape a request uses most:
write a row, get its id back.
TypedInsertReturningBuilder
TypedUpdateReturningBuilder
TypedDeleteReturningBuilder
TypedMergeBuilder
TypedMergeReturningBuilder
ExplainBuilder
The RETURNING forms carry their row type through and run themselves, like
SELECT. MERGE and EXPLAIN have no executor behind them, so their compiled
queries hold the SQL and fill parameters but say so if asked to run.
`test/builder/every-builder-compiles.test.ts` reads `src/builder` and fails
on any class with a `toSQL` and no `toCompiled`. The hole appears when
somebody adds a builder, not when they add a test, so the check has to come
from the source rather than from a list someone remembers to update.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HAwiBVhLmNhWjC9Ro6UMpb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-on to #192, closing the last of the gaps between the two phases.
Six builders could produce SQL and not a compiled query, so their callers were left on the path that runs the whole pipeline per request:
insertInto(...).returning(...)is the one that matters most — write a row, get its id back is what a request does, and it was the shape with no way to prepare.The RETURNING forms carry their row type through and run themselves, the same as SELECT. MERGE and EXPLAIN have no executor behind them, so their compiled queries hold the SQL and fill parameters but say so if asked to run.
The check that keeps it closed
test/builder/every-builder-compiles.test.tsreadssrc/builderand fails on any exported class with atoSQLand notoCompiled. The hole appears when somebody adds a builder, not when they add a test, so the check reads the source rather than a list someone has to remember to update.pnpm testgreen: 3311 tests, lint clean, types clean, build clean.