cloudflare / cloudflare/workers-rs
[Feature] support .raw({columnNames: true}) for D1PreparedStatement
- Dominant language
- Rust
- Stars
- 3.7k
- Forks
- 429
- Avg merge
- 20h 28m
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Description
So there currently are bindings for calling `.raw()` on a prepared statement.
https://github.com/cloudflare/workers-rs/blob/bb141710ebcf38b5a61c6e8f1d1c20c3dd2f3f6d/worker-sys/src/types/d1.rs#L98-L99
However, the option to fetch column names too via `.raw({columnNames: true})` is not supported right now.
https://developers.cloudflare.com/d1/worker-api/prepared-statements/#raw
It would be great for writing interfaces to existing ORMs like diesel.
I'm currently forking & updating an old diesel-d1 codebase I found (fork: https://github.com/hydrogen602/diesel-d1) and diesel indexes into a row via an `usize` so returning arrays of arrays are perfect for that.
Contributor guide
Research direction
Start by reading worker-sys/src/types/d1.rs around lines 98-99 and the linked D1 raw() documentation. Confirm how options are represented in the existing bindings, then expose the columnNames option for D1PreparedStatement::raw while preserving existing raw() behavior; done means callers can request column names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100