metal-orm 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/decorators/index.cjs +192 -46
- package/dist/decorators/index.cjs.map +1 -1
- package/dist/decorators/index.d.cts +1 -1
- package/dist/decorators/index.d.ts +1 -1
- package/dist/decorators/index.js +192 -46
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.cjs +245 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -29
- package/dist/index.d.ts +16 -29
- package/dist/index.js +243 -66
- package/dist/index.js.map +1 -1
- package/dist/{select-BPCn6MOH.d.cts → select-BuMpVcVt.d.cts} +83 -11
- package/dist/{select-BPCn6MOH.d.ts → select-BuMpVcVt.d.ts} +83 -11
- package/package.json +61 -54
- package/src/codegen/naming-strategy.ts +15 -10
- package/src/core/ast/builders.ts +23 -3
- package/src/core/ast/expression-builders.ts +14 -1
- package/src/core/ast/expression-nodes.ts +11 -9
- package/src/core/ast/join-node.ts +5 -3
- package/src/core/ast/join.ts +16 -16
- package/src/core/ast/query.ts +44 -29
- package/src/core/ddl/dialects/mssql-schema-dialect.ts +18 -0
- package/src/core/ddl/dialects/mysql-schema-dialect.ts +11 -0
- package/src/core/ddl/dialects/postgres-schema-dialect.ts +9 -0
- package/src/core/ddl/dialects/sqlite-schema-dialect.ts +9 -0
- package/src/core/dialect/base/sql-dialect.ts +58 -46
- package/src/core/dialect/mssql/index.ts +53 -28
- package/src/core/dialect/sqlite/index.ts +22 -13
- package/src/query-builder/column-selector.ts +9 -7
- package/src/query-builder/query-ast-service.ts +59 -38
- package/src/query-builder/relation-conditions.ts +38 -34
- package/src/query-builder/relation-manager.ts +8 -3
- package/src/query-builder/relation-service.ts +59 -46
- package/src/query-builder/select-query-state.ts +19 -7
- package/src/query-builder/select.ts +215 -135
- package/src/schema/column.ts +75 -39
- package/src/schema/types.ts +1 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LiteralNode, O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, b as LogicalExpressionNode, N as NullExpressionNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as
|
|
2
|
-
export {
|
|
1
|
+
import { L as LiteralNode, O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, b as LogicalExpressionNode, N as NullExpressionNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as FunctionTableNode, s as DerivedTableNode, t as TableSourceNode, u as ForeignKeyReference, v as IndexColumn, w as IndexDef, x as DbExecutor, H as HydrationPlan, y as NamingStrategy, R as RelationMap, z as EntityContext, A as Entity, G as HasManyRelation, K as HasOneRelation, M as BelongsToRelation, P as BelongsToManyRelation, Q as HasManyCollection, V as BelongsToReference, X as ManyToManyCollection, Y as OrmSession, Z as SelectQueryBuilder, _ as ExecutionContext, $ as HydrationContext } from './select-BuMpVcVt.cjs';
|
|
2
|
+
export { aL as AnyDomainEvent, ab as CascadeMode, a0 as CheckConstraint, ai as ColumnToTs, a4 as ColumnType, ay as DbExecutorFactory, a7 as DefaultValue, aK as DomainEvent, aD as DomainEventBus, aB as DomainEventHandler, aF as EntityStatus, az as ExternalTransaction, aN as HasDomainEvents, ak as HasOneReference, au as HydrationMetadata, as as HydrationPivotPlan, at as HydrationRelationPlan, aj as InferRow, aC as InitialHandlers, aA as Orm, aM as OrmDomainEvent, av as OrmInterceptor, ax as OrmOptions, aw as OrmSessionOptions, aO as QueryLogEntry, aP as QueryLogger, aR as QueryResult, a6 as RawDefaultValue, a5 as ReferentialAction, aI as RelationChange, aJ as RelationChangeEntry, ac as RelationDef, aH as RelationKey, a9 as RelationKinds, ah as RelationTargetTable, aa as RelationType, aT as SimpleQueryRunner, a2 as TableHooks, a1 as TableOptions, aG as TrackedEntity, aE as addDomainEvent, af as belongsTo, ag as belongsToMany, a8 as col, al as createColumn, aU as createExecutorFromQueryRunner, am as createLiteral, aQ as createQueryLoggingExecutor, a3 as defineTable, ad as hasMany, ae as hasOne, ap as isCaseExpressionNode, ar as isExpressionSelectionNode, ao as isFunctionNode, an as isOperandNode, aq as isWindowFunctionNode, aS as rowsToQueryResult } from './select-BuMpVcVt.cjs';
|
|
3
3
|
|
|
4
4
|
type LiteralValue = LiteralNode['value'];
|
|
5
5
|
type ValueOperandInput = OperandNode | LiteralValue;
|
|
@@ -11,6 +11,15 @@ type ValueOperandInput = OperandNode | LiteralValue;
|
|
|
11
11
|
declare const valueToOperand: (value: ValueOperandInput) => OperandNode;
|
|
12
12
|
declare const isValueOperandInput: (value: unknown) => value is ValueOperandInput;
|
|
13
13
|
declare const columnOperand: (col: ColumnRef | ColumnNode) => ColumnNode;
|
|
14
|
+
/**
|
|
15
|
+
* Marks a column reference as an outer-scope reference for correlated subqueries.
|
|
16
|
+
* Primarily semantic; SQL rendering still uses the provided table/alias name.
|
|
17
|
+
*/
|
|
18
|
+
declare const outerRef: (col: ColumnRef | ColumnNode) => ColumnNode;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an outer-scoped column reference using a specific table or alias name.
|
|
21
|
+
*/
|
|
22
|
+
declare const correlateBy: (table: string, column: string) => ColumnNode;
|
|
14
23
|
/**
|
|
15
24
|
* Creates an equality expression (left = right)
|
|
16
25
|
* @param left - Left operand
|
|
@@ -414,27 +423,6 @@ declare class DeleteQueryBuilder<T> {
|
|
|
414
423
|
getAST(): DeleteQueryNode;
|
|
415
424
|
}
|
|
416
425
|
|
|
417
|
-
interface FunctionTableNode {
|
|
418
|
-
type: 'FunctionTable';
|
|
419
|
-
schema?: string;
|
|
420
|
-
name: string;
|
|
421
|
-
args?: unknown[];
|
|
422
|
-
lateral?: boolean;
|
|
423
|
-
withOrdinality?: boolean;
|
|
424
|
-
alias?: string;
|
|
425
|
-
columnAliases?: string[];
|
|
426
|
-
}
|
|
427
|
-
interface FunctionTableNode {
|
|
428
|
-
type: 'FunctionTable';
|
|
429
|
-
schema?: string;
|
|
430
|
-
name: string;
|
|
431
|
-
args?: unknown[];
|
|
432
|
-
lateral?: boolean;
|
|
433
|
-
withOrdinality?: boolean;
|
|
434
|
-
alias?: string;
|
|
435
|
-
columnAliases?: string[];
|
|
436
|
-
}
|
|
437
|
-
|
|
438
426
|
/**
|
|
439
427
|
* Strategy interface for compiling pagination clauses.
|
|
440
428
|
* Allows dialects to customize how pagination (LIMIT/OFFSET, ROWS FETCH, etc.) is generated.
|
|
@@ -490,6 +478,7 @@ declare abstract class SqlDialectBase extends Dialect {
|
|
|
490
478
|
protected compileSelectColumns(ast: SelectQueryNode, ctx: CompilerContext): string;
|
|
491
479
|
protected compileFrom(ast: SelectQueryNode['from'], ctx?: CompilerContext): string;
|
|
492
480
|
protected compileFunctionTable(fn: FunctionTableNode, ctx?: CompilerContext): string;
|
|
481
|
+
protected compileDerivedTable(table: DerivedTableNode, ctx?: CompilerContext): string;
|
|
493
482
|
protected compileTableSource(table: TableSourceNode): string;
|
|
494
483
|
protected compileTableName(table: {
|
|
495
484
|
name: string;
|
|
@@ -499,11 +488,6 @@ declare abstract class SqlDialectBase extends Dialect {
|
|
|
499
488
|
protected stripTrailingSemicolon(sql: string): string;
|
|
500
489
|
protected wrapSetOperand(sql: string): string;
|
|
501
490
|
}
|
|
502
|
-
interface TableSourceNode {
|
|
503
|
-
name: string;
|
|
504
|
-
schema?: string;
|
|
505
|
-
alias?: string;
|
|
506
|
-
}
|
|
507
491
|
|
|
508
492
|
/**
|
|
509
493
|
* MySQL dialect implementation
|
|
@@ -568,6 +552,8 @@ declare class SqlServerDialect extends Dialect {
|
|
|
568
552
|
private compileSelectCore;
|
|
569
553
|
private compileOrderBy;
|
|
570
554
|
private compilePagination;
|
|
555
|
+
private compileTableSource;
|
|
556
|
+
private compileDerivedTable;
|
|
571
557
|
private compileCtes;
|
|
572
558
|
private wrapSetOperand;
|
|
573
559
|
}
|
|
@@ -594,6 +580,7 @@ declare class SqliteDialect extends SqlDialectBase {
|
|
|
594
580
|
*/
|
|
595
581
|
protected compileJsonPath(node: JsonPathNode): string;
|
|
596
582
|
protected compileReturning(returning: ColumnNode[] | undefined, ctx: CompilerContext): string;
|
|
583
|
+
protected formatReturningColumns(returning: ColumnNode[]): string;
|
|
597
584
|
supportsReturning(): boolean;
|
|
598
585
|
}
|
|
599
586
|
|
|
@@ -1352,4 +1339,4 @@ interface MssqlClientLike {
|
|
|
1352
1339
|
}
|
|
1353
1340
|
declare function createMssqlExecutor(client: MssqlClientLike): DbExecutor;
|
|
1354
1341
|
|
|
1355
|
-
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, type GroupConcatOptions, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, type LiteralValue, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, groupConcat, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, isValueOperandInput, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sel, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
|
1342
|
+
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, type GroupConcatOptions, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, type LiteralValue, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, groupConcat, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, isValueOperandInput, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sel, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LiteralNode, O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, b as LogicalExpressionNode, N as NullExpressionNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as
|
|
2
|
-
export {
|
|
1
|
+
import { L as LiteralNode, O as OperandNode, C as ColumnRef, a as ColumnNode, B as BinaryExpressionNode, E as ExpressionNode, b as LogicalExpressionNode, N as NullExpressionNode, I as InExpressionNode, c as BetweenExpressionNode, J as JsonPathNode, d as CaseExpressionNode, S as SelectQueryNode, e as ExistsExpressionNode, W as WindowFunctionNode, f as OrderDirection, F as FunctionNode, g as ScalarSubqueryNode, h as ColumnDef, T as TableRef, i as TableDef, j as InsertQueryNode, k as InsertCompiler, l as CompiledQuery, D as Dialect, m as DialectKey, U as UpdateQueryNode, n as UpdateCompiler, o as DeleteQueryNode, p as DeleteCompiler, q as CompilerContext, r as FunctionTableNode, s as DerivedTableNode, t as TableSourceNode, u as ForeignKeyReference, v as IndexColumn, w as IndexDef, x as DbExecutor, H as HydrationPlan, y as NamingStrategy, R as RelationMap, z as EntityContext, A as Entity, G as HasManyRelation, K as HasOneRelation, M as BelongsToRelation, P as BelongsToManyRelation, Q as HasManyCollection, V as BelongsToReference, X as ManyToManyCollection, Y as OrmSession, Z as SelectQueryBuilder, _ as ExecutionContext, $ as HydrationContext } from './select-BuMpVcVt.js';
|
|
2
|
+
export { aL as AnyDomainEvent, ab as CascadeMode, a0 as CheckConstraint, ai as ColumnToTs, a4 as ColumnType, ay as DbExecutorFactory, a7 as DefaultValue, aK as DomainEvent, aD as DomainEventBus, aB as DomainEventHandler, aF as EntityStatus, az as ExternalTransaction, aN as HasDomainEvents, ak as HasOneReference, au as HydrationMetadata, as as HydrationPivotPlan, at as HydrationRelationPlan, aj as InferRow, aC as InitialHandlers, aA as Orm, aM as OrmDomainEvent, av as OrmInterceptor, ax as OrmOptions, aw as OrmSessionOptions, aO as QueryLogEntry, aP as QueryLogger, aR as QueryResult, a6 as RawDefaultValue, a5 as ReferentialAction, aI as RelationChange, aJ as RelationChangeEntry, ac as RelationDef, aH as RelationKey, a9 as RelationKinds, ah as RelationTargetTable, aa as RelationType, aT as SimpleQueryRunner, a2 as TableHooks, a1 as TableOptions, aG as TrackedEntity, aE as addDomainEvent, af as belongsTo, ag as belongsToMany, a8 as col, al as createColumn, aU as createExecutorFromQueryRunner, am as createLiteral, aQ as createQueryLoggingExecutor, a3 as defineTable, ad as hasMany, ae as hasOne, ap as isCaseExpressionNode, ar as isExpressionSelectionNode, ao as isFunctionNode, an as isOperandNode, aq as isWindowFunctionNode, aS as rowsToQueryResult } from './select-BuMpVcVt.js';
|
|
3
3
|
|
|
4
4
|
type LiteralValue = LiteralNode['value'];
|
|
5
5
|
type ValueOperandInput = OperandNode | LiteralValue;
|
|
@@ -11,6 +11,15 @@ type ValueOperandInput = OperandNode | LiteralValue;
|
|
|
11
11
|
declare const valueToOperand: (value: ValueOperandInput) => OperandNode;
|
|
12
12
|
declare const isValueOperandInput: (value: unknown) => value is ValueOperandInput;
|
|
13
13
|
declare const columnOperand: (col: ColumnRef | ColumnNode) => ColumnNode;
|
|
14
|
+
/**
|
|
15
|
+
* Marks a column reference as an outer-scope reference for correlated subqueries.
|
|
16
|
+
* Primarily semantic; SQL rendering still uses the provided table/alias name.
|
|
17
|
+
*/
|
|
18
|
+
declare const outerRef: (col: ColumnRef | ColumnNode) => ColumnNode;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an outer-scoped column reference using a specific table or alias name.
|
|
21
|
+
*/
|
|
22
|
+
declare const correlateBy: (table: string, column: string) => ColumnNode;
|
|
14
23
|
/**
|
|
15
24
|
* Creates an equality expression (left = right)
|
|
16
25
|
* @param left - Left operand
|
|
@@ -414,27 +423,6 @@ declare class DeleteQueryBuilder<T> {
|
|
|
414
423
|
getAST(): DeleteQueryNode;
|
|
415
424
|
}
|
|
416
425
|
|
|
417
|
-
interface FunctionTableNode {
|
|
418
|
-
type: 'FunctionTable';
|
|
419
|
-
schema?: string;
|
|
420
|
-
name: string;
|
|
421
|
-
args?: unknown[];
|
|
422
|
-
lateral?: boolean;
|
|
423
|
-
withOrdinality?: boolean;
|
|
424
|
-
alias?: string;
|
|
425
|
-
columnAliases?: string[];
|
|
426
|
-
}
|
|
427
|
-
interface FunctionTableNode {
|
|
428
|
-
type: 'FunctionTable';
|
|
429
|
-
schema?: string;
|
|
430
|
-
name: string;
|
|
431
|
-
args?: unknown[];
|
|
432
|
-
lateral?: boolean;
|
|
433
|
-
withOrdinality?: boolean;
|
|
434
|
-
alias?: string;
|
|
435
|
-
columnAliases?: string[];
|
|
436
|
-
}
|
|
437
|
-
|
|
438
426
|
/**
|
|
439
427
|
* Strategy interface for compiling pagination clauses.
|
|
440
428
|
* Allows dialects to customize how pagination (LIMIT/OFFSET, ROWS FETCH, etc.) is generated.
|
|
@@ -490,6 +478,7 @@ declare abstract class SqlDialectBase extends Dialect {
|
|
|
490
478
|
protected compileSelectColumns(ast: SelectQueryNode, ctx: CompilerContext): string;
|
|
491
479
|
protected compileFrom(ast: SelectQueryNode['from'], ctx?: CompilerContext): string;
|
|
492
480
|
protected compileFunctionTable(fn: FunctionTableNode, ctx?: CompilerContext): string;
|
|
481
|
+
protected compileDerivedTable(table: DerivedTableNode, ctx?: CompilerContext): string;
|
|
493
482
|
protected compileTableSource(table: TableSourceNode): string;
|
|
494
483
|
protected compileTableName(table: {
|
|
495
484
|
name: string;
|
|
@@ -499,11 +488,6 @@ declare abstract class SqlDialectBase extends Dialect {
|
|
|
499
488
|
protected stripTrailingSemicolon(sql: string): string;
|
|
500
489
|
protected wrapSetOperand(sql: string): string;
|
|
501
490
|
}
|
|
502
|
-
interface TableSourceNode {
|
|
503
|
-
name: string;
|
|
504
|
-
schema?: string;
|
|
505
|
-
alias?: string;
|
|
506
|
-
}
|
|
507
491
|
|
|
508
492
|
/**
|
|
509
493
|
* MySQL dialect implementation
|
|
@@ -568,6 +552,8 @@ declare class SqlServerDialect extends Dialect {
|
|
|
568
552
|
private compileSelectCore;
|
|
569
553
|
private compileOrderBy;
|
|
570
554
|
private compilePagination;
|
|
555
|
+
private compileTableSource;
|
|
556
|
+
private compileDerivedTable;
|
|
571
557
|
private compileCtes;
|
|
572
558
|
private wrapSetOperand;
|
|
573
559
|
}
|
|
@@ -594,6 +580,7 @@ declare class SqliteDialect extends SqlDialectBase {
|
|
|
594
580
|
*/
|
|
595
581
|
protected compileJsonPath(node: JsonPathNode): string;
|
|
596
582
|
protected compileReturning(returning: ColumnNode[] | undefined, ctx: CompilerContext): string;
|
|
583
|
+
protected formatReturningColumns(returning: ColumnNode[]): string;
|
|
597
584
|
supportsReturning(): boolean;
|
|
598
585
|
}
|
|
599
586
|
|
|
@@ -1352,4 +1339,4 @@ interface MssqlClientLike {
|
|
|
1352
1339
|
}
|
|
1353
1340
|
declare function createMssqlExecutor(client: MssqlClientLike): DbExecutor;
|
|
1354
1341
|
|
|
1355
|
-
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, type GroupConcatOptions, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, type LiteralValue, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, groupConcat, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, isValueOperandInput, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sel, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|
|
1342
|
+
export { AsyncLocalStorage, BelongsToManyRelation, BelongsToReference, BelongsToRelation, BetweenExpressionNode, BinaryExpressionNode, CaseExpressionNode, ColumnDef, type ColumnDiff, ColumnNode, ColumnRef, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, DbExecutor, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, DeleteQueryBuilder, type DialectName, Entity, EntityContext, ExecutionContext, ExistsExpressionNode, ExpressionNode, type ExpressionVisitor, ForeignKeyReference, FunctionNode, type GroupConcatOptions, HasManyCollection, HasManyRelation, HasOneRelation, HydrationContext, HydrationPlan, InExpressionNode, IndexColumn, IndexDef, InsertQueryBuilder, type IntrospectOptions, JsonPathNode, LiteralNode, type LiteralValue, LogicalExpressionNode, ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, NullExpressionNode, OperandNode, type OperandVisitor, OrmSession, type PostgresClientLike, PostgresDialect, RelationMap, type RenderColumnOptions, ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, TableDef, TableRef, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, WindowFunctionNode, abs, acos, and, ascii, asin, atan, atan2, avg, between, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createMssqlExecutor, createMysqlExecutor, createPostgresExecutor, createSqliteExecutor, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, degrees, denseRank, diffSchema, endOfMonth, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getSchemaIntrospector, groupConcat, gt, gte, hydrateRows, inList, instr, introspectSchema, isNotNull, isNull, isValueOperandInput, jsonPath, lag, lastValue, lead, left, length, like, ln, loadBelongsToManyRelation, loadBelongsToRelation, loadHasManyRelation, loadHasOneRelation, locate, log, log10, logBase, lower, lpad, lt, lte, ltrim, max, min, mod, month, neq, notBetween, notExists, notInList, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rpad, rtrim, sel, sign, sin, space, sqrt, substr, sum, synchronizeSchema, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|