This page explains concepts available on drizzle versions 1.0.0-beta.9 and higher.
Effect is only available for PostgreSQL right now and soon be implemented for all other dialects
On how to upgrade (read more here)
This page explains concepts available on drizzle versions 1.0.0-beta.9 and higher.
Effect is only available for PostgreSQL right now and soon be implemented for all other dialects
On how to upgrade (read more here)
Drizzle has native support for Effect PostgreSQL connections with the @effect/sql-pg driver
npm i drizzle-orm effect @effect/sql-pg pg
npm i -D drizzle-kit
import 'dotenv/config';
import { drizzle } from 'drizzle-orm/effect-postgres';
import { Effect, Redacted } from 'effect';
import { PgClient } from '@effect/sql-pg'
import { types } from 'pg';
const clientLayer = PgClient.layer({
url: Redacted.make(process.env.DATABASE_URL!);
types: {
getTypeParser: (typeId, format) => {
if ([1184, 1114, 1082, 1186, 1231, 1115, 1185, 1187, 1182].includes(typeId)) {
return (val: any) => val;
}
return types.getTypeParser(typeId, format);
},
},
});
const program = Effect.gen(function*() {
const client = yield* PgClient.PgClient;
const db = drizzle(client, { logger: true, /*...*/ });
});
await Effect.runPromise(program).pipe(Effect.provide(clientLayer));