schema.d.ts 1.1 KB

12345678910111213141516171819202122
  1. import { entityKind } from "../entity.js";
  2. import { SQL, type SQLWrapper } from "../sql/sql.js";
  3. import type { NonArray, Writable } from "../utils.js";
  4. import { type PgEnum, type PgEnumObject } from "./columns/enum.js";
  5. import { type pgSequence } from "./sequence.js";
  6. import { type PgTableFn } from "./table.js";
  7. import { type pgMaterializedView, type pgView } from "./view.js";
  8. export declare class PgSchema<TName extends string = string> implements SQLWrapper {
  9. readonly schemaName: TName;
  10. static readonly [entityKind]: string;
  11. constructor(schemaName: TName);
  12. table: PgTableFn<TName>;
  13. view: typeof pgView;
  14. materializedView: typeof pgMaterializedView;
  15. enum<U extends string, T extends Readonly<[U, ...U[]]>>(enumName: string, values: T | Writable<T>): PgEnum<Writable<T>>;
  16. enum<E extends Record<string, string>>(enumName: string, enumObj: NonArray<E>): PgEnumObject<E>;
  17. sequence: typeof pgSequence;
  18. getSQL(): SQL;
  19. shouldOmitSQLParens(): boolean;
  20. }
  21. export declare function isPgSchema(obj: unknown): obj is PgSchema;
  22. export declare function pgSchema<T extends string>(name: T): PgSchema<T>;