query-builder.d.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { entityKind } from "../../entity.js";
  2. import type { GelDialectConfig } from "../dialect.js";
  3. import { GelDialect } from "../dialect.js";
  4. import type { TypedQueryBuilder } from "../../query-builders/query-builder.js";
  5. import type { ColumnsSelection, SQLWrapper } from "../../sql/sql.js";
  6. import { WithSubquery } from "../../subquery.js";
  7. import type { GelColumn } from "../columns/index.js";
  8. import type { WithSubqueryWithSelection } from "../subquery.js";
  9. import { GelSelectBuilder } from "./select.js";
  10. import type { SelectedFields } from "./select.types.js";
  11. export declare class QueryBuilder {
  12. static readonly [entityKind]: string;
  13. private dialect;
  14. private dialectConfig;
  15. constructor(dialect?: GelDialect | GelDialectConfig);
  16. $with<TAlias extends string>(alias: TAlias): {
  17. as<TSelection extends ColumnsSelection>(qb: TypedQueryBuilder<TSelection> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection>)): WithSubqueryWithSelection<TSelection, TAlias>;
  18. };
  19. with(...queries: WithSubquery[]): {
  20. select: {
  21. (): GelSelectBuilder<undefined, "qb">;
  22. <TSelection extends SelectedFields>(fields: TSelection): GelSelectBuilder<TSelection, "qb">;
  23. };
  24. selectDistinct: {
  25. (): GelSelectBuilder<undefined, "qb">;
  26. <TSelection extends SelectedFields>(fields: TSelection): GelSelectBuilder<TSelection, "qb">;
  27. };
  28. selectDistinctOn: {
  29. (on: (GelColumn | SQLWrapper)[]): GelSelectBuilder<undefined, "qb">;
  30. <TSelection extends SelectedFields>(on: (GelColumn | SQLWrapper)[], fields: TSelection): GelSelectBuilder<TSelection, "qb">;
  31. };
  32. };
  33. select(): GelSelectBuilder<undefined, 'qb'>;
  34. select<TSelection extends SelectedFields>(fields: TSelection): GelSelectBuilder<TSelection, 'qb'>;
  35. selectDistinct(): GelSelectBuilder<undefined>;
  36. selectDistinct<TSelection extends SelectedFields>(fields: TSelection): GelSelectBuilder<TSelection>;
  37. selectDistinctOn(on: (GelColumn | SQLWrapper)[]): GelSelectBuilder<undefined>;
  38. selectDistinctOn<TSelection extends SelectedFields>(on: (GelColumn | SQLWrapper)[], fields: TSelection): GelSelectBuilder<TSelection>;
  39. private getDialect;
  40. }