driver.d.cts 1.1 KB

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