Connect
Source:
src/Cloudflare/Hyperdrive/Connect.ts
A typed accessor for a Cloudflare Hyperdrive runtime binding inside a
Worker. Provides the same shape as the raw Hyperdrive runtime object
(connection string, host, port, user, password, database) plus a raw
escape hatch for libraries that want direct access.
Examples
Section titled “Examples”Bind Hyperdrive in a Worker
const hd = yield* Cloudflare.Hyperdrive.Connect(MyConnection);const url = yield* hd.connectionString;/ /** Bind a {@link Connection} to a Worker and obtain the Effect-native Hyperdrive client (connection string, host, port, …).
Connect is a single identifier that is simultaneously the binding’s Context
tag, its type, and the callable — yield* Cloudflare.Hyperdrive.Connect(conn).
Using Hyperdrive inside a Worker
const hd = yield* Cloudflare.Hyperdrive.Connect(MyConnection);const url = yield* hd.connectionString;