Add D1 batch support#6524
Conversation
🦋 Changeset detectedLatest commit: 52d3d3c The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughD1Client gains an atomic ChangesD1 batch execution
Estimated code review effort: 4 (Complex) | ~45 minutes Suggested labels: Sequence Diagram(s)sequenceDiagram
participant D1Client
participant StatementTransformer
participant makeBatch
participant D1Database
D1Client->>makeBatch: batch(statements)
makeBatch->>StatementTransformer: compile statements
StatementTransformer-->>makeBatch: compiled SQL
makeBatch->>D1Database: prepare and execute db.batch
D1Database-->>makeBatch: ordered results or error
makeBatch-->>D1Client: transformed results or SqlError
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.changeset/d1-batch-statements.md (1)
1-6: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUse
minorfor this changeset
D1Client.batchadds a new public API, so@effect/sql-d1should be bumped asminor, notpatch.📝 Proposed fix
--- -"`@effect/sql-d1`": patch +"`@effect/sql-d1`": minor ---🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/d1-batch-statements.md around lines 1 - 6, Update the changeset frontmatter for `@effect/sql-d1` from patch to minor to reflect the new public D1Client.batch API; leave the changeset description unchanged.Source: Coding guidelines
🧹 Nitpick comments (1)
packages/sql/d1/src/D1Client.ts (1)
62-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMissing
@categorytag on new publicbatchJSDoc.The new
batchJSDoc includes@since 4.0.0but no@categorytag, which the repo's JSDoc conventions expect for public API members.📝 Proposed fix
* `@since` 4.0.0 + * `@category` combinators */As per coding guidelines,
**/*.{ts,tsx,md,mdx}: "Follow public JSDoc@categoryconventions from.patterns/jsdoc.md."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/sql/d1/src/D1Client.ts` around lines 62 - 85, Update the public batch member JSDoc in D1Client to include the repository-standard `@category` tag, while preserving the existing description and `@since` 4.0.0 annotation.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.changeset/d1-batch-statements.md:
- Around line 1-6: Update the changeset frontmatter for `@effect/sql-d1` from
patch to minor to reflect the new public D1Client.batch API; leave the changeset
description unchanged.
---
Nitpick comments:
In `@packages/sql/d1/src/D1Client.ts`:
- Around line 62-85: Update the public batch member JSDoc in D1Client to include
the repository-standard `@category` tag, while preserving the existing description
and `@since` 4.0.0 annotation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1f6b373d-9650-4c24-9846-39ec8f80b1a4
📒 Files selected for processing (3)
.changeset/d1-batch-statements.mdpackages/sql/d1/src/D1Client.tspackages/sql/d1/test/Client.test.ts
Summary
D1Client.batch, backed by nativeD1Database.batchDetails
withoutTransforms()Statement.CurrentTransformersql.executetracing with thebatchoperationSqlError[]without calling D1withTransactionbehavior unchangedSqlClient.batchTxEnables a follow-up implementation of
.batch()indrizzle-orm/effect-d1.Tests
Related
Refs #3888 and #5594. Previous
batchTxdiscussion: #3045.Summary by CodeRabbit
New Features
Bug Fixes