Consolidated run-raw APIs, add specialized runBoth Capability #24
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.
PR Title
Make raw SQL execution explicitly opt-in and add internal
runBothAPIsSummary
This PR tightens the story around Terpal-SQL’s “escape hatch” raw-SQL APIs and introduces new internal helpers that return both decoded results and raw column metadata. The main goals are:
Key Changes
1. New unsafe opt-in annotation
TerpalSqlUnsafe:@RequiresOptIn.BINARY-retained.This gives a single, consistent annotation for all unsafe SQL entry points.
2. Centralized unsafe run-raw “escape hatch”
runActionsUnsafeis now annotated with@TerpalSqlUnsafe.;-separated statements and runs them as actions on a controller.controller-corenow:TerpalSqlUnsafe.@OptIn(TerpalSqlUnsafe::class)either at function or class level.Effectively, any use of the unsafe escape hatch in tests must now opt in explicitly, making these usages easy to audit.
3. Internalization of controller plumbing
TerpalSqlInternalas a@RequiresOptInannotation for internal library APIs:@TerpalSqlInternalto internal controller primitives and helpers, including:ControllerVerbsmethods such asstream,run, andrunRaw, plus defaulted overloads.This separates the “intended public surface” from the implementation hooks, while still letting advanced users opt in if needed.
4. New internal
runBothAPIsrunBoth(query, options)returnsList<Pair<T, RawColumnSet>>.streamBothvariant.@TerpalSqlInternal.run/streamAPI shape but return:T).RawColumnSetsnapshot for the same row.These will be used by the ExoQuery playground to demonstrate how a controller can surface both typed result sets and raw column metadata without expanding the public API surface yet.
Rationale
TerpalSqlUnsafeand requiring@OptIn(TerpalSqlUnsafe::class)at call sites, any use of this escape hatch is explicit, reviewable, and intentionally noisy in code.TerpalSqlInternallets us:runBoth,runRaw, etc.).runBothAPIs give the playground a way to show:Testing / Impact
@OptIn(TerpalSqlUnsafe::class).runActionsUnsafeitself is unchanged; only its opt-in contract and call sites changed.