Returns a connection string for the pooled database.
The Worker environment.
A connection string accepted by the usual drivers and ORMs.
Returns the connection details as discrete fields.
For drivers that take a credentials object rather than a URL.
The Worker environment.
Host, port, user, password, and database name.
Reports whether Hyperdrive is bound to this Worker.
The Worker environment.
true when the binding is present.
Reports which database the binding points at.
Deliberately excludes the password and the connection string, so this is safe to surface in a health check.
The Worker environment.
The target host and database name, or null when unbound.
External-database capability, backed by Hyperdrive.
Remarks
Hyperdrive supplies a pooled, cached connection — not a client. The query itself runs through a driver (
postgres,pg,mysql2, …) that this boilerplate does not depend on, so this capability hands the connection out and stops there:Keep the pool small — each isolate opens its own, and Hyperdrive is already pooling on the far side.
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0