Skip to content

Commit

Permalink
refactor: use more fitting variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
mastondzn committed May 29, 2024
1 parent c664cdb commit 9dcafae
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions packages/db/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ import { schema } from './schema';
import type { Database, DatabaseOptions, KyselyDatabase } from './types';

export function createDatabase(options: DatabaseOptions): Database {
const sql = postgres(options);
const db = drizzle(sql, { ...options, schema });
const dialect = new PostgresJSDialect({
postgres: sql,
});
const raw = postgres(options);
const db = drizzle(raw, { ...options, schema });

const find = new FindHelpers(db);
const edit = new EditHelpers(db);
const ky = new Kysely<KyselyDatabase>({ dialect });
const ky = new Kysely<KyselyDatabase>({
dialect: new PostgresJSDialect({ postgres: raw }),
});

return Object.assign(db, { find, edit, ky, raw: sql });
return Object.assign(db, { find, edit, ky, raw });
}

export * from './types';
Expand Down

0 comments on commit 9dcafae

Please sign in to comment.