// import { Pool } from "pg"; import { neon } from "@neondatabase/serverless"; import { Kysely /*PostgresDialect*/ } from "kysely"; import { NeonDialect } from "kysely-neon"; import type Database from "./generated/Database"; // export const pool = new Pool({ // connectionString: env.POSTGRES_CONNECTION_STRING as string, // // channelBinding: require ? // }); // const dialect = new PostgresDialect({ // pool, // }); export function getDbClient(POSTGRES_CONNECTION_STRING: string) { const dialect = new NeonDialect({ neon: neon(POSTGRES_CONNECTION_STRING as string), }); // Database interface is passed to Kysely's constructor, and from now on, Kysely // knows your database structure. // Dialect is passed to Kysely's constructor, and from now on, Kysely knows how // to communicate with your database. const dbClient = new Kysely({ dialect, }); return dbClient; }