utils.d.cts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { SQL } from "../index.cjs";
  2. import { Subquery } from "../subquery.cjs";
  3. import type { Check } from "./checks.cjs";
  4. import type { ForeignKey } from "./foreign-keys.cjs";
  5. import type { Index } from "./indexes.cjs";
  6. import type { PrimaryKey } from "./primary-keys.cjs";
  7. import type { IndexForHint } from "./query-builders/select.cjs";
  8. import { MySqlTable } from "./table.cjs";
  9. import { type UniqueConstraint } from "./unique-constraint.cjs";
  10. import type { MySqlViewBase } from "./view-base.cjs";
  11. import type { MySqlView } from "./view.cjs";
  12. export declare function extractUsedTable(table: MySqlTable | Subquery | MySqlViewBase | SQL): string[];
  13. export declare function getTableConfig(table: MySqlTable): {
  14. columns: import("./index.ts").MySqlColumn<import("../index.ts").ColumnBaseConfig<import("../index.ts").ColumnDataType, string>, {}, {}>[];
  15. indexes: Index[];
  16. foreignKeys: ForeignKey[];
  17. checks: Check[];
  18. primaryKeys: PrimaryKey[];
  19. uniqueConstraints: UniqueConstraint[];
  20. name: string;
  21. schema: string | undefined;
  22. baseName: string;
  23. };
  24. export declare function getViewConfig<TName extends string = string, TExisting extends boolean = boolean>(view: MySqlView<TName, TExisting>): {
  25. algorithm?: "undefined" | "merge" | "temptable";
  26. sqlSecurity?: "definer" | "invoker";
  27. withCheckOption?: "cascaded" | "local";
  28. name: TName;
  29. originalName: TName;
  30. schema: string | undefined;
  31. selectedFields: import("../index.ts").ColumnsSelection;
  32. isExisting: TExisting;
  33. query: TExisting extends true ? undefined : SQL<unknown>;
  34. isAlias: boolean;
  35. };
  36. export declare function convertIndexToString(indexes: IndexForHint[]): string[];
  37. export declare function toArray<T>(value: T | T[]): T[];