Skip to content

ConnectPostgres

Source: src/Fly/ConnectPostgres.ts

Bind a Postgres cluster to a Fly Service and obtain the Effect-native connection strings for Drizzle.Postgres / SQL.Postgres.

ConnectPostgres is the Context tag, the type, and the callable — yield* Fly.ConnectPostgres(Db). Provide ConnectPostgresHttp.

import * as Drizzle from "alchemy/Drizzle/Postgres";
const conn = yield* Fly.ConnectPostgres(Db);
const db = yield* Drizzle.Postgres(conn.connectionString);
fetch: Effect.gen(function* () {
const rows = yield* db.select().from(users);
});