postgres: added pg and postgres, and examples for xata and neon

This commit is contained in:
dswbx
2025-06-06 16:52:07 +02:00
parent abbd372ddf
commit 58c7aba1a4
21 changed files with 509 additions and 247 deletions

View File

@@ -2,6 +2,8 @@ import {
type AliasableExpression,
type ColumnBuilderCallback,
type ColumnDataType,
type DatabaseIntrospector,
type Dialect,
type Expression,
type Kysely,
type KyselyPlugin,
@@ -12,7 +14,8 @@ import {
type Simplify,
sql,
} from "kysely";
import type { BaseIntrospector } from "./BaseIntrospector";
import type { BaseIntrospector, BaseIntrospectorConfig } from "./BaseIntrospector";
import type { Constructor } from "core";
export type QB = SelectQueryBuilder<any, any, any>;
@@ -159,3 +162,19 @@ export abstract class Connection<DB = any> {
// no-op by default
}
}
export function customIntrospector<T extends Constructor<Dialect>>(
dialect: T,
introspector: Constructor<DatabaseIntrospector>,
options: BaseIntrospectorConfig = {},
) {
return {
create(...args: ConstructorParameters<T>) {
return new (class extends dialect {
override createIntrospector(db: Kysely<any>): DatabaseIntrospector {
return new introspector(db, options);
}
})(...args);
},
};
}