10 lines
263 B
TypeScript
10 lines
263 B
TypeScript
|
|
import type { D1Database } from '@cloudflare/workers-types';
|
||
|
|
import { drizzle } from 'drizzle-orm/d1';
|
||
|
|
import * as schema from './schema.js';
|
||
|
|
|
||
|
|
export type DB = ReturnType<typeof getDb>;
|
||
|
|
|
||
|
|
export function getDb(d1: D1Database) {
|
||
|
|
return drizzle(d1, { schema });
|
||
|
|
}
|