workers-rs
workers-rs copied to clipboard
[Feature] D1 Support
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
It would be great if workers-rs had the functionality of wrangler@d1. Although I understand that it may not be the best time to do this as D1 is still in private beta, but it would be cool if the D1 integration was ready to go by the time D1 is public!
I would also be interested in this. I'm also aware that the current state of D1 is in private beta so it may not be doable at the moment.
So I am curious if it is possible to have a worker using both Rust and Typescript in the meanwhile? Where the D1 code is located in Typescript and the main worker code in Rust.
So I am curious if it is possible to have a worker using both Rust and Typescript in the meanwhile? Where the D1 code is located in Typescript and the main worker code in Rust.
It is possible, but it's a bit messy. You can use wasm-bindgen snippets generated from TypeScript and then call it from your Rust or you avoid using worker-build
and use esbuild
yourself to bundle in some JavaScript that you do your D1 calls in. In the future I think we'll have to figure out how we're going to go about private-beta bindings, possible through an unstable
feature flag?
Until then, D1 support is probably off the table for now.
In the future I think we'll have to figure out how we're going to go about private-beta bindings, possible through an
unstable
feature flag?
Yeah this sounds like a good idea, some sort of unstable branch for non-GA features.
I was also thinking of an alternative solution. Having two separate workers, one in Rust and one "normal" in Typescript and connecting them via a service binding. This would mean having to transfer stuff between them though.
it is now open alpha ╰(°▽°)╯
So do we have an status update on this?
https://github.com/cloudflare/workers-rs/pull/246
#270
I can't enable d1 feature but I have seen this commit that not released in 0.0.17. Any updates?
I can't enable d1 feature but I have seen this commit that not released in 0.0.17. Any updates?
It's been released as of 0.0.18:
worker = {version = "0.0.18", features = ["d1"] }