Skip to content

[proxy_cloudflare_worker_example] Reimplemented ProxyDatabaseTrait for reusability.#3036

Open
bjn7 wants to merge 1 commit intoSeaQL:masterfrom
bjn7:master
Open

[proxy_cloudflare_worker_example] Reimplemented ProxyDatabaseTrait for reusability.#3036
bjn7 wants to merge 1 commit intoSeaQL:masterfrom
bjn7:master

Conversation

@bjn7
Copy link
Copy Markdown

@bjn7 bjn7 commented Apr 3, 2026

I rewrote the previously named orm.rs, which is now renamed to d1bridge.rs, The code is now decoupled making it a generic, reusable component. It can now be dropped into any project and used by simply importing clean connect_d1 function. Additionally, I updated the codebase related to new ProxyDatabaseTrait implementation.

Summary of Changes:

  • src/d1bridge.rs: Contains the generic (not related to the type system, 'generic' as an English word) connect_d1 function described above.
  • Cargo.toml: Removed the unused crate oneshot, which was previously used as a workaround for the Send trait (now replaced by worker::send::Future).
  • lib.rs: Instead of connecting to the database from each endpoint, the connection is now handled centrally in fetch and supplied to route.rs, from where it is distributed to all endpoints via state.
  • route.rs: The core endpoints remain the same, but they were modified to work with the new state and include some refactoring of clustered code.
  • utility.rs: Clustered code unrelated to routes was moved here.
  • wrangler.toml: Apparently, the filename is case sensitive, has been renamed from Wrangler.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant