driver.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829
  1. import { type Options, type PostgresType, type Sql } from 'postgres';
  2. import { entityKind } from "../entity.js";
  3. import { PgDatabase } from "../pg-core/db.js";
  4. import { type DrizzleConfig } from "../utils.js";
  5. import type { PostgresJsQueryResultHKT } from "./session.js";
  6. export declare class PostgresJsDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<PostgresJsQueryResultHKT, TSchema> {
  7. static readonly [entityKind]: string;
  8. }
  9. export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends Sql = Sql>(...params: [
  10. TClient | string
  11. ] | [
  12. TClient | string,
  13. DrizzleConfig<TSchema>
  14. ] | [
  15. (DrizzleConfig<TSchema> & ({
  16. connection: string | ({
  17. url?: string;
  18. } & Options<Record<string, PostgresType>>);
  19. } | {
  20. client: TClient;
  21. }))
  22. ]): PostgresJsDatabase<TSchema> & {
  23. $client: TClient;
  24. };
  25. export declare namespace drizzle {
  26. function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): PostgresJsDatabase<TSchema> & {
  27. $client: '$client is not available on drizzle.mock()';
  28. };
  29. }