| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { entityKind } from "../entity.js";
- import { GelColumn } from "./columns/index.js";
- import type { GelDeleteConfig, GelInsertConfig, GelUpdateConfig } from "./query-builders/index.js";
- import type { GelSelectConfig } from "./query-builders/select.types.js";
- import { GelTable } from "./table.js";
- import { type BuildRelationalQueryResult, type DBQueryConfig, type Relation, type TableRelationalConfig, type TablesRelationalConfig } from "../relations.js";
- import { type DriverValueEncoder, type QueryTypingsValue, type QueryWithTypings, SQL } from "../sql/sql.js";
- import { type Casing, type UpdateSet } from "../utils.js";
- import type { GelMaterializedView } from "./view.js";
- export interface GelDialectConfig {
- casing?: Casing;
- }
- export declare class GelDialect {
- static readonly [entityKind]: string;
- constructor(config?: GelDialectConfig);
- escapeName(name: string): string;
- escapeParam(num: number): string;
- escapeString(str: string): string;
- private buildWithCTE;
- buildDeleteQuery({ table, where, returning, withList }: GelDeleteConfig): SQL;
- buildUpdateSet(table: GelTable, set: UpdateSet): SQL;
- buildUpdateQuery({ table, set, where, returning, withList, from, joins }: GelUpdateConfig): SQL;
- /**
- * Builds selection SQL with provided fields/expressions
- *
- * Examples:
- *
- * `select <selection> from`
- *
- * `insert ... returning <selection>`
- *
- * If `isSingleTable` is true, then columns won't be prefixed with table name
- * ^ Temporarily disabled behaviour, see comments within method for a reasoning
- */
- private buildSelection;
- private buildJoins;
- private buildFromTable;
- buildSelectQuery({ withList, fields, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, }: GelSelectConfig): SQL;
- buildSetOperations(leftSelect: SQL, setOperators: GelSelectConfig['setOperators']): SQL;
- buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset }, }: {
- leftSelect: SQL;
- setOperator: GelSelectConfig['setOperators'][number];
- }): SQL;
- buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_ }: GelInsertConfig): SQL;
- buildRefreshMaterializedViewQuery({ view, concurrently, withNoData }: {
- view: GelMaterializedView;
- concurrently?: boolean;
- withNoData?: boolean;
- }): SQL;
- prepareTyping(encoder: DriverValueEncoder<unknown, unknown>): QueryTypingsValue;
- sqlToQuery(sql: SQL, invokeSource?: 'indexes' | undefined): QueryWithTypings;
- buildRelationalQueryWithoutPK({ fullSchema, schema, tableNamesMap, table, tableConfig, queryConfig: config, tableAlias, nestedQueryRelation, joinOn, }: {
- fullSchema: Record<string, unknown>;
- schema: TablesRelationalConfig;
- tableNamesMap: Record<string, string>;
- table: GelTable;
- tableConfig: TableRelationalConfig;
- queryConfig: true | DBQueryConfig<'many', true>;
- tableAlias: string;
- nestedQueryRelation?: Relation;
- joinOn?: SQL;
- }): BuildRelationalQueryResult<GelTable, GelColumn>;
- }
|