You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Add native Cloudflare D1 database driver support #2928
Full SQL execution: Support for execute, query_one, query_all
D1QueryExecutor trait: Entity query support (works around wasm-bindgen Send bound limitation)
D1Row & D1ExecResult: Result types for D1 query handling
TryGetable support: D1-specific type conversions
Example Usage
use worker::{Env, event};#[event(fetch)]asyncfnfetch(req:Request,env:Env,_ctx:Context) -> Result<Response>{let d1 = env.d1("DB")?;let db = sea_orm::Database::connect_d1(d1).await?;// Entity queries work!let cakes = cake::Entity::find().all(&db).await?;// Direct SQL also works
db.execute(statement).await?;Ok(Response::ok("Hello")?)}
Technical Notes
The implementation uses a custom D1QueryExecutor trait with impl Future return type to work around wasm-bindgen's requirement that futures be Send. This allows Entity queries without requiring the full ConnectionTrait implementation.
Activity