| 3 | import * as schema from "@/db/schema" |
| 4 | |
| 5 | export class Database< |
| 6 | T extends { |
| 7 | DATABASE_URL: string |
| 8 | COMULINE_ENV: string |
| 9 | }, |
| 10 | > { |
| 11 | db: NeonDatabase<typeof schema> |
| 12 | |
| 13 | constructor(protected env: T) { |
| 14 | this.db = connectDB(env.DATABASE_URL, env.COMULINE_ENV) |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | export const connectDB = (url: string, env: string) => { |
| 19 | if (env === "development") { |
nothing calls this directly
no outgoing calls
no test coverage detected