Repository navigation
feat(prepared): Phase 7.8 — prepared statements - #91
Merged
Merged
Conversation
Adds EdnValue::BindSlot(String), AsOf::Slot(String), ValidAt::Slot(String), and Expr::Slot(String) — parse-only variants representing $name tokens in prepared query templates. Must be substituted before reaching the executor. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dSlot variants Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion, and substitution Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n/edn fields Replace three mem::replace(&mut field, EdnValue::Nil) patterns with borrow-then-clone, so non-BindSlot values (variables, literals) are never overwritten with Nil before the match is tested. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…alue Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (64.51%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
==========================================
- Coverage 84.61% 83.73% -0.89%
==========================================
Files 25 26 +1
Lines 4569 4788 +219
==========================================
+ Hits 3866 4009 +143
- Misses 703 779 +76
🚀 New features to boost your workflow:
|
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.
Summary
Minigraf::prepare(query_str)→PreparedQuery— parse and plan a query once with named$slotbind slotsPreparedQuery::execute(&[(&str, BindValue)])→QueryResult— substitute concrete values and run, with full type checking per slot positionBindValueandPreparedQueryfrom the crate root for ergonomic useApproach
Option A (inline substitution): deep-clone the AST at
execute()time, walk and replaceBindSlot/Slotnodes with concrete values, pass the filled query to the existing executor unchanged. The executor, optimizer, matcher, evaluator, and stratification modules are untouched beyond panic guards for unsubstituted slots.Changes
types.rs— 4 new variants:EdnValue::BindSlot,AsOf::Slot,ValidAt::Slot,Expr::Slotparser.rs— tokenise$identifier, parse to AST slot variants;Expr::Slotreturnsvec![]inexpr_varsexecutor.rs/storage.rs— panic guards at all temporal and expression match sitesprepared.rs(new) —BindValue,PreparedQuery, substitution logic, 19 unit testsdb.rs—Minigraf::prepare()with non-query rejectionlib.rs— re-exportstests/prepared_statements_test.rs— 17 integration tests covering all slot positions, error paths, and plan reuseTest Plan
cargo test— 796 tests, 0 failures (was 753 before this phase)cargo test --test prepared_statements_test— all 17 integration tests passcargo clippy— no warningscargo fmt --check— cleanCloses #88
🤖 Generated with Claude Code