Open ChihweiLHBird opened 3 months ago
Hi @ChihweiLHBird, we (@RustLangES) are planning to do an implementation of an agnostic ORM focused on Cloudflare Workers in Rust. You can follow our progress in this discussion. We are an spanish community, but we accept people who speak any language.
We've discussed an integration with something like SQLx, but the API surface that we would need to implement is quite daunting.
@kflansburg We already have an experimental ORM for one of our project (The api is not the best). As I said it is so experimental, but we are working on to build a library to extend Cloudflare Workers. It will have a lot of utilities to do the best developer experience.
The same as @ChihweiLHBird, I invite you to our discussion or discord to share us your ideas.
While not a full a ORM, I created a PR to allow cornucopia to be used within cloudflare-worker. Since all the query are build in compile time, the only thing I need to do is allow tokio-postgres to compile in wasm.
https://github.com/cornucopia-rs/cornucopia/pull/256
cornucopia is a SQL first query-builder to generate rust query.
Just found this in the sea-orm repo https://github.com/SeaQL/sea-orm/blob/039e4423d3ef2fe4959c0b19c2b37bbd3f90d9b9/examples/proxy_cloudflare_worker_example/README.md
By creating proxy-backend allows one to use sea-orm that calls D1, maybe the same can be made for postgres that calls the socket.connect without having to rely on sqlx(used by sea-orm) for providing the connection.
Just found this in the sea-orm repo https://github.com/SeaQL/sea-orm/blob/039e4423d3ef2fe4959c0b19c2b37bbd3f90d9b9/examples/proxy_cloudflare_worker_example/README.md
By creating proxy-backend allows one to use sea-orm that calls D1, maybe the same can be made for postgres that calls the socket.connect without having to rely on sqlx(used by sea-orm) for providing the connection.
This does look like a pretty simple interface to implement. I haven't used Sea ORM. Pulling this in for D1, as well as supporting Hyperdrive (behind a crate feature) seems pretty interesting.
this is an issue i first posted @ https://github.com/SeaQL/sea-query/issues/838, but i'll just copy over the contents here in case it has any relevance
trying to use cloudflare d1 with sea-orm through the example proxy integration, but
null values hit the
_
case since internallyD1Result::results()
returns a javascript array which will treat null values as their own type when deserialized through serde, making it incompatible with sea-query'sValue
enum, which requires to know the type ahead of timeis there a reasonable way to accommodate for this?
Is there an existing issue for this?
Description
JavaScript workers are capable of Prisma ORM to query Cloudflare D1 database: https://developers.cloudflare.com/d1/tutorials/d1-and-prisma-orm/
It would be very nice to have a similar ORM support in the Rust workers as well.