mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
29 lines
800 B
TypeScript
29 lines
800 B
TypeScript
import { DummyDriver, Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from 'kysely';
|
|
|
|
import type { DittoDB } from '../DittoDB.ts';
|
|
import type { DittoTables } from '../DittoTables.ts';
|
|
|
|
export class DummyDB implements DittoDB {
|
|
readonly kysely: Kysely<DittoTables>;
|
|
readonly poolSize = 0;
|
|
readonly availableConnections = 0;
|
|
|
|
constructor() {
|
|
this.kysely = new Kysely<DittoTables>({
|
|
dialect: {
|
|
createAdapter: () => new PostgresAdapter(),
|
|
createDriver: () => new DummyDriver(),
|
|
createIntrospector: (db) => new PostgresIntrospector(db),
|
|
createQueryCompiler: () => new PostgresQueryCompiler(),
|
|
},
|
|
});
|
|
}
|
|
|
|
listen(): void {
|
|
// noop
|
|
}
|
|
|
|
[Symbol.asyncDispose](): Promise<void> {
|
|
return Promise.resolve();
|
|
}
|
|
}
|