metal-orm 1.0.43 → 1.0.44
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 +173 -30
- package/dist/index.cjs +896 -476
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1146 -275
- package/dist/index.d.ts +1146 -275
- package/dist/index.js +896 -474
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ast/adapters.ts +8 -2
- package/src/core/ast/builders.ts +105 -81
- package/src/core/ast/expression-builders.ts +430 -390
- package/src/core/ast/expression-visitor.ts +47 -8
- package/src/core/ast/helpers.ts +23 -0
- package/src/core/ast/join-node.ts +17 -1
- package/src/core/ddl/dialects/base-schema-dialect.ts +7 -1
- package/src/core/ddl/dialects/index.ts +1 -0
- package/src/core/ddl/dialects/mssql-schema-dialect.ts +1 -0
- package/src/core/ddl/dialects/mysql-schema-dialect.ts +1 -0
- package/src/core/ddl/dialects/postgres-schema-dialect.ts +1 -0
- package/src/core/ddl/dialects/sqlite-schema-dialect.ts +1 -0
- package/src/core/ddl/introspect/catalogs/index.ts +1 -0
- package/src/core/ddl/introspect/catalogs/postgres.ts +2 -0
- package/src/core/ddl/introspect/context.ts +6 -0
- package/src/core/ddl/introspect/functions/postgres.ts +13 -0
- package/src/core/ddl/introspect/mssql.ts +11 -0
- package/src/core/ddl/introspect/mysql.ts +2 -0
- package/src/core/ddl/introspect/postgres.ts +14 -0
- package/src/core/ddl/introspect/registry.ts +14 -0
- package/src/core/ddl/introspect/run-select.ts +13 -0
- package/src/core/ddl/introspect/sqlite.ts +22 -0
- package/src/core/ddl/introspect/utils.ts +18 -0
- package/src/core/ddl/naming-strategy.ts +6 -0
- package/src/core/ddl/schema-dialect.ts +19 -6
- package/src/core/ddl/schema-diff.ts +22 -0
- package/src/core/ddl/schema-generator.ts +22 -0
- package/src/core/ddl/schema-plan-executor.ts +6 -0
- package/src/core/ddl/schema-types.ts +6 -0
- package/src/core/dialect/abstract.ts +2 -2
- package/src/core/execution/pooling/pool.ts +12 -7
- package/src/core/functions/datetime.ts +57 -33
- package/src/core/functions/numeric.ts +95 -30
- package/src/core/functions/standard-strategy.ts +35 -0
- package/src/core/functions/text.ts +83 -22
- package/src/core/functions/types.ts +23 -8
- package/src/decorators/bootstrap.ts +16 -4
- package/src/decorators/column.ts +17 -0
- package/src/decorators/decorator-metadata.ts +27 -0
- package/src/decorators/entity.ts +8 -0
- package/src/decorators/index.ts +3 -0
- package/src/decorators/relations.ts +32 -0
- package/src/orm/als.ts +34 -9
- package/src/orm/entity-context.ts +54 -0
- package/src/orm/entity-metadata.ts +122 -9
- package/src/orm/execute.ts +15 -0
- package/src/orm/lazy-batch.ts +68 -98
- package/src/orm/relations/has-many.ts +44 -0
- package/src/query/index.ts +74 -0
- package/src/query/target.ts +46 -0
- package/src/query-builder/delete-query-state.ts +30 -0
- package/src/query-builder/delete.ts +64 -19
- package/src/query-builder/hydration-manager.ts +46 -0
- package/src/query-builder/insert-query-state.ts +30 -0
- package/src/query-builder/insert.ts +46 -2
- package/src/query-builder/query-ast-service.ts +5 -0
- package/src/query-builder/query-resolution.ts +78 -0
- package/src/query-builder/raw-column-parser.ts +5 -0
- package/src/query-builder/relation-alias.ts +7 -0
- package/src/query-builder/relation-conditions.ts +61 -48
- package/src/query-builder/relation-service.ts +68 -63
- package/src/query-builder/relation-utils.ts +3 -0
- package/src/query-builder/select/cte-facet.ts +40 -0
- package/src/query-builder/select/from-facet.ts +80 -0
- package/src/query-builder/select/join-facet.ts +62 -0
- package/src/query-builder/select/predicate-facet.ts +103 -0
- package/src/query-builder/select/projection-facet.ts +69 -0
- package/src/query-builder/select/relation-facet.ts +81 -0
- package/src/query-builder/select/setop-facet.ts +36 -0
- package/src/query-builder/select-helpers.ts +13 -0
- package/src/query-builder/select-query-builder-deps.ts +19 -1
- package/src/query-builder/select-query-state.ts +2 -1
- package/src/query-builder/select.ts +795 -1163
- package/src/query-builder/update-query-state.ts +52 -0
- package/src/query-builder/update.ts +69 -19
- package/src/schema/table-guards.ts +31 -0
package/dist/index.d.cts
CHANGED
|
@@ -781,6 +781,12 @@ declare const isValueOperandInput: (value: unknown) => value is ValueOperandInpu
|
|
|
781
781
|
type SelectQueryInput = SelectQueryNode | {
|
|
782
782
|
getAST(): SelectQueryNode;
|
|
783
783
|
};
|
|
784
|
+
/**
|
|
785
|
+
* Converts a ColumnRef or ColumnNode to a ColumnNode
|
|
786
|
+
* @param col - Column reference or node
|
|
787
|
+
* @returns ColumnNode
|
|
788
|
+
* @throws Error if ColumnRef doesn't have a table specified
|
|
789
|
+
*/
|
|
784
790
|
declare const columnOperand: (col: ColumnRef | ColumnNode) => ColumnNode;
|
|
785
791
|
/**
|
|
786
792
|
* Marks a column reference as an outer-scope reference for correlated subqueries.
|
|
@@ -1353,17 +1359,32 @@ interface HydrationMetadata {
|
|
|
1353
1359
|
[key: string]: unknown;
|
|
1354
1360
|
}
|
|
1355
1361
|
|
|
1362
|
+
/**
|
|
1363
|
+
* Context provided to function renderers.
|
|
1364
|
+
*/
|
|
1356
1365
|
interface FunctionRenderContext {
|
|
1366
|
+
/** The function node being rendered. */
|
|
1357
1367
|
node: FunctionNode;
|
|
1368
|
+
/** The compiled arguments for the function. */
|
|
1358
1369
|
compiledArgs: string[];
|
|
1359
|
-
/** Helper to compile additional operands (e.g., separators or ORDER BY columns) */
|
|
1370
|
+
/** Helper to compile additional operands (e.g., separators or ORDER BY columns). */
|
|
1360
1371
|
compileOperand: (operand: OperandNode) => string;
|
|
1361
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* A function that renders a SQL function call.
|
|
1375
|
+
* @param ctx - The rendering context.
|
|
1376
|
+
* @returns The rendered SQL string.
|
|
1377
|
+
*/
|
|
1362
1378
|
type FunctionRenderer = (ctx: FunctionRenderContext) => string;
|
|
1379
|
+
/**
|
|
1380
|
+
* Strategy for rendering SQL functions in a specific dialect.
|
|
1381
|
+
*/
|
|
1363
1382
|
interface FunctionStrategy {
|
|
1364
1383
|
/**
|
|
1365
1384
|
* Returns a renderer for a specific function name (e.g. "DATE_ADD").
|
|
1366
1385
|
* Returns undefined if this dialect doesn't support the function.
|
|
1386
|
+
* @param functionName - The name of the function.
|
|
1387
|
+
* @returns The renderer function or undefined.
|
|
1367
1388
|
*/
|
|
1368
1389
|
getRenderer(functionName: string): FunctionRenderer | undefined;
|
|
1369
1390
|
}
|
|
@@ -1746,6 +1767,11 @@ declare class HydrationManager {
|
|
|
1746
1767
|
* applied to parent rows when eager-loading multiplicative relations.
|
|
1747
1768
|
*/
|
|
1748
1769
|
private requiresParentPagination;
|
|
1770
|
+
/**
|
|
1771
|
+
* Checks if the hydration plan contains relations that multiply rows
|
|
1772
|
+
* @param plan - Hydration plan to check
|
|
1773
|
+
* @returns True if plan has HasMany or BelongsToMany relations
|
|
1774
|
+
*/
|
|
1749
1775
|
private hasMultiplyingRelations;
|
|
1750
1776
|
/**
|
|
1751
1777
|
* Rewrites the query using CTEs so LIMIT/OFFSET target distinct parent rows
|
|
@@ -1757,11 +1783,52 @@ declare class HydrationManager {
|
|
|
1757
1783
|
* - Join the base CTE against the paged ids to retrieve the joined rows for just that page.
|
|
1758
1784
|
*/
|
|
1759
1785
|
private wrapForParentPagination;
|
|
1786
|
+
/**
|
|
1787
|
+
* Generates a unique CTE name by appending a suffix if needed
|
|
1788
|
+
* @param existing - Existing CTE nodes
|
|
1789
|
+
* @param baseName - Base name for the CTE
|
|
1790
|
+
* @returns Unique CTE name
|
|
1791
|
+
*/
|
|
1760
1792
|
private nextCteName;
|
|
1793
|
+
/**
|
|
1794
|
+
* Extracts projection names from column nodes
|
|
1795
|
+
* @param columns - Projection nodes
|
|
1796
|
+
* @returns Array of names or undefined if any column lacks name/alias
|
|
1797
|
+
*/
|
|
1761
1798
|
private getProjectionNames;
|
|
1799
|
+
/**
|
|
1800
|
+
* Builds a map of column keys to their aliases from projection nodes
|
|
1801
|
+
* @param columns - Projection nodes
|
|
1802
|
+
* @returns Map of 'table.name' to alias
|
|
1803
|
+
*/
|
|
1762
1804
|
private buildProjectionAliasMap;
|
|
1805
|
+
/**
|
|
1806
|
+
* Maps order by nodes to use base CTE alias
|
|
1807
|
+
* @param orderBy - Original order by nodes
|
|
1808
|
+
* @param plan - Hydration plan
|
|
1809
|
+
* @param projectionAliases - Map of column aliases
|
|
1810
|
+
* @param baseAlias - Base CTE alias
|
|
1811
|
+
* @param availableColumns - Set of available column names
|
|
1812
|
+
* @returns Mapped order by nodes, null if cannot map
|
|
1813
|
+
*/
|
|
1763
1814
|
private mapOrderBy;
|
|
1815
|
+
/**
|
|
1816
|
+
* Maps a single ordering term to use base CTE alias
|
|
1817
|
+
* @param term - Ordering term to map
|
|
1818
|
+
* @param plan - Hydration plan
|
|
1819
|
+
* @param projectionAliases - Map of column aliases
|
|
1820
|
+
* @param baseAlias - Base CTE alias
|
|
1821
|
+
* @param availableColumns - Set of available column names
|
|
1822
|
+
* @returns Mapped term or null if cannot map
|
|
1823
|
+
*/
|
|
1764
1824
|
private mapOrderingTerm;
|
|
1825
|
+
/**
|
|
1826
|
+
* Builds column nodes for paging CTE
|
|
1827
|
+
* @param primaryKey - Primary key name
|
|
1828
|
+
* @param orderBy - Order by nodes
|
|
1829
|
+
* @param tableAlias - Table alias for columns
|
|
1830
|
+
* @returns Array of column nodes for paging
|
|
1831
|
+
*/
|
|
1765
1832
|
private buildPagingColumns;
|
|
1766
1833
|
}
|
|
1767
1834
|
|
|
@@ -1887,6 +1954,11 @@ declare class QueryAstService {
|
|
|
1887
1954
|
* @returns Combined expression
|
|
1888
1955
|
*/
|
|
1889
1956
|
private combineExpressions;
|
|
1957
|
+
/**
|
|
1958
|
+
* Normalizes an ordering term to a standard OrderingTerm
|
|
1959
|
+
* @param term - Column definition or ordering term to normalize
|
|
1960
|
+
* @returns Normalized ordering term
|
|
1961
|
+
*/
|
|
1890
1962
|
private normalizeOrderingTerm;
|
|
1891
1963
|
}
|
|
1892
1964
|
|
|
@@ -2000,6 +2072,115 @@ declare class RelationService {
|
|
|
2000
2072
|
private rootTableName;
|
|
2001
2073
|
}
|
|
2002
2074
|
|
|
2075
|
+
/**
|
|
2076
|
+
* Type for column selection input
|
|
2077
|
+
*/
|
|
2078
|
+
type ColumnSelectionInput = Record<string, ColumnDef | FunctionNode | CaseExpressionNode | WindowFunctionNode>;
|
|
2079
|
+
/**
|
|
2080
|
+
* Handles column selection operations for the query builder
|
|
2081
|
+
*/
|
|
2082
|
+
declare class ColumnSelector {
|
|
2083
|
+
private readonly env;
|
|
2084
|
+
/**
|
|
2085
|
+
* Creates a new ColumnSelector instance
|
|
2086
|
+
* @param env - Query builder environment
|
|
2087
|
+
*/
|
|
2088
|
+
constructor(env: SelectQueryBuilderEnvironment);
|
|
2089
|
+
/**
|
|
2090
|
+
* Selects columns for the query
|
|
2091
|
+
* @param context - Current query context
|
|
2092
|
+
* @param columns - Columns to select
|
|
2093
|
+
* @returns Updated query context with selected columns
|
|
2094
|
+
*/
|
|
2095
|
+
select(context: SelectQueryBuilderContext, columns: ColumnSelectionInput): SelectQueryBuilderContext;
|
|
2096
|
+
/**
|
|
2097
|
+
* Selects raw column expressions
|
|
2098
|
+
* @param context - Current query context
|
|
2099
|
+
* @param columns - Raw column expressions
|
|
2100
|
+
* @returns Updated query context with raw column selections
|
|
2101
|
+
*/
|
|
2102
|
+
selectRaw(context: SelectQueryBuilderContext, columns: string[]): SelectQueryBuilderContext;
|
|
2103
|
+
/**
|
|
2104
|
+
* Selects a subquery as a column
|
|
2105
|
+
* @param context - Current query context
|
|
2106
|
+
* @param alias - Alias for the subquery
|
|
2107
|
+
* @param query - Subquery to select
|
|
2108
|
+
* @returns Updated query context with subquery selection
|
|
2109
|
+
*/
|
|
2110
|
+
selectSubquery(context: SelectQueryBuilderContext, alias: string, query: SelectQueryNode): SelectQueryBuilderContext;
|
|
2111
|
+
/**
|
|
2112
|
+
* Adds DISTINCT clause to the query
|
|
2113
|
+
* @param context - Current query context
|
|
2114
|
+
* @param columns - Columns to make distinct
|
|
2115
|
+
* @returns Updated query context with DISTINCT clause
|
|
2116
|
+
*/
|
|
2117
|
+
distinct(context: SelectQueryBuilderContext, columns: (ColumnDef | ColumnNode)[]): SelectQueryBuilderContext;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* Manages relation operations (joins, includes, etc.) for query building
|
|
2122
|
+
*/
|
|
2123
|
+
declare class RelationManager {
|
|
2124
|
+
private readonly env;
|
|
2125
|
+
/**
|
|
2126
|
+
* Creates a new RelationManager instance
|
|
2127
|
+
* @param env - Query builder environment
|
|
2128
|
+
*/
|
|
2129
|
+
constructor(env: SelectQueryBuilderEnvironment);
|
|
2130
|
+
/**
|
|
2131
|
+
* Matches records based on a relation with an optional predicate
|
|
2132
|
+
* @param context - Current query context
|
|
2133
|
+
* @param relationName - Name of the relation to match
|
|
2134
|
+
* @param predicate - Optional predicate expression
|
|
2135
|
+
* @returns Updated query context with relation match
|
|
2136
|
+
*/
|
|
2137
|
+
match(context: SelectQueryBuilderContext, relationName: string, predicate?: ExpressionNode): SelectQueryBuilderContext;
|
|
2138
|
+
/**
|
|
2139
|
+
* Joins a relation to the query
|
|
2140
|
+
* @param context - Current query context
|
|
2141
|
+
* @param relationName - Name of the relation to join
|
|
2142
|
+
* @param joinKind - Type of join to use
|
|
2143
|
+
* @param extraCondition - Additional join condition
|
|
2144
|
+
* @returns Updated query context with relation join
|
|
2145
|
+
*/
|
|
2146
|
+
joinRelation(context: SelectQueryBuilderContext, relationName: string, joinKind: JoinKind, extraCondition?: ExpressionNode): SelectQueryBuilderContext;
|
|
2147
|
+
/**
|
|
2148
|
+
* Includes a relation in the query result
|
|
2149
|
+
* @param context - Current query context
|
|
2150
|
+
* @param relationName - Name of the relation to include
|
|
2151
|
+
* @param options - Options for relation inclusion
|
|
2152
|
+
* @returns Updated query context with included relation
|
|
2153
|
+
*/
|
|
2154
|
+
include(context: SelectQueryBuilderContext, relationName: string, options?: RelationIncludeOptions): SelectQueryBuilderContext;
|
|
2155
|
+
/**
|
|
2156
|
+
* Applies relation correlation to a query AST
|
|
2157
|
+
* @param context - Current query context
|
|
2158
|
+
* @param relationName - Name of the relation
|
|
2159
|
+
* @param ast - Query AST to modify
|
|
2160
|
+
* @returns Modified query AST with relation correlation
|
|
2161
|
+
*/
|
|
2162
|
+
applyRelationCorrelation(context: SelectQueryBuilderContext, relationName: string, ast: SelectQueryNode, additionalCorrelation?: ExpressionNode): SelectQueryNode;
|
|
2163
|
+
/**
|
|
2164
|
+
* Creates a relation service instance
|
|
2165
|
+
* @param context - Current query context
|
|
2166
|
+
* @returns Relation service instance
|
|
2167
|
+
*/
|
|
2168
|
+
private createService;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Context for query building operations
|
|
2173
|
+
*/
|
|
2174
|
+
interface SelectQueryBuilderContext {
|
|
2175
|
+
/**
|
|
2176
|
+
* Current query state
|
|
2177
|
+
*/
|
|
2178
|
+
readonly state: SelectQueryState;
|
|
2179
|
+
/**
|
|
2180
|
+
* Hydration manager for the query
|
|
2181
|
+
*/
|
|
2182
|
+
readonly hydration: HydrationManager;
|
|
2183
|
+
}
|
|
2003
2184
|
/**
|
|
2004
2185
|
* Dependencies for query builder operations
|
|
2005
2186
|
*/
|
|
@@ -2037,6 +2218,31 @@ interface SelectQueryBuilderDependencies {
|
|
|
2037
2218
|
* @returns New relation service
|
|
2038
2219
|
*/
|
|
2039
2220
|
createRelationService: (table: TableDef, state: SelectQueryState, hydration: HydrationManager) => RelationService;
|
|
2221
|
+
/**
|
|
2222
|
+
* Creates a new column selector
|
|
2223
|
+
* @param env - Query builder environment
|
|
2224
|
+
* @returns New column selector
|
|
2225
|
+
*/
|
|
2226
|
+
createColumnSelector: (env: SelectQueryBuilderEnvironment) => ColumnSelector;
|
|
2227
|
+
/**
|
|
2228
|
+
* Creates a new relation manager
|
|
2229
|
+
* @param env - Query builder environment
|
|
2230
|
+
* @returns New relation manager
|
|
2231
|
+
*/
|
|
2232
|
+
createRelationManager: (env: SelectQueryBuilderEnvironment) => RelationManager;
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Environment for query builder operations
|
|
2236
|
+
*/
|
|
2237
|
+
interface SelectQueryBuilderEnvironment {
|
|
2238
|
+
/**
|
|
2239
|
+
* Table definition
|
|
2240
|
+
*/
|
|
2241
|
+
readonly table: TableDef;
|
|
2242
|
+
/**
|
|
2243
|
+
* Query builder dependencies
|
|
2244
|
+
*/
|
|
2245
|
+
readonly deps: SelectQueryBuilderDependencies;
|
|
2040
2246
|
}
|
|
2041
2247
|
|
|
2042
2248
|
type QueryResult = {
|
|
@@ -2077,8 +2283,19 @@ interface SimpleQueryRunner {
|
|
|
2077
2283
|
*/
|
|
2078
2284
|
declare function createExecutorFromQueryRunner(runner: SimpleQueryRunner): DbExecutor;
|
|
2079
2285
|
|
|
2080
|
-
|
|
2286
|
+
/**
|
|
2287
|
+
* Constructor type for entities.
|
|
2288
|
+
* Supports any constructor signature for maximum flexibility with decorator-based entities.
|
|
2289
|
+
* @template T - The entity type
|
|
2290
|
+
*/
|
|
2291
|
+
type EntityConstructor<T = object> = new (...args: never[]) => T;
|
|
2292
|
+
/**
|
|
2293
|
+
* Target that can be an entity constructor or table definition.
|
|
2294
|
+
*/
|
|
2081
2295
|
type EntityOrTableTarget = EntityConstructor | TableDef;
|
|
2296
|
+
/**
|
|
2297
|
+
* Resolver for entity or table target, can be direct or function.
|
|
2298
|
+
*/
|
|
2082
2299
|
type EntityOrTableTargetResolver = EntityOrTableTarget | (() => EntityOrTableTarget);
|
|
2083
2300
|
|
|
2084
2301
|
/**
|
|
@@ -2643,16 +2860,67 @@ interface ExecutionContext {
|
|
|
2643
2860
|
interceptors: InterceptorPipeline;
|
|
2644
2861
|
}
|
|
2645
2862
|
|
|
2863
|
+
/**
|
|
2864
|
+
* Interface for entity context providing entity tracking and management.
|
|
2865
|
+
*/
|
|
2646
2866
|
interface EntityContext {
|
|
2867
|
+
/** The database dialect */
|
|
2647
2868
|
dialect: Dialect;
|
|
2869
|
+
/** The database executor */
|
|
2648
2870
|
executor: DbExecutor;
|
|
2871
|
+
/**
|
|
2872
|
+
* Gets an entity by table and primary key.
|
|
2873
|
+
* @param table - The table definition
|
|
2874
|
+
* @param pk - The primary key value
|
|
2875
|
+
* @returns The entity or undefined
|
|
2876
|
+
*/
|
|
2649
2877
|
getEntity(table: TableDef, pk: unknown): unknown;
|
|
2878
|
+
/**
|
|
2879
|
+
* Sets an entity in the context.
|
|
2880
|
+
* @param table - The table definition
|
|
2881
|
+
* @param pk - The primary key value
|
|
2882
|
+
* @param entity - The entity to set
|
|
2883
|
+
*/
|
|
2650
2884
|
setEntity(table: TableDef, pk: unknown, entity: unknown): void;
|
|
2885
|
+
/**
|
|
2886
|
+
* Tracks a new entity.
|
|
2887
|
+
* @param table - The table definition
|
|
2888
|
+
* @param entity - The new entity
|
|
2889
|
+
* @param pk - Optional primary key
|
|
2890
|
+
*/
|
|
2651
2891
|
trackNew(table: TableDef, entity: unknown, pk?: unknown): void;
|
|
2892
|
+
/**
|
|
2893
|
+
* Tracks a managed entity.
|
|
2894
|
+
* @param table - The table definition
|
|
2895
|
+
* @param pk - The primary key
|
|
2896
|
+
* @param entity - The managed entity
|
|
2897
|
+
*/
|
|
2652
2898
|
trackManaged(table: TableDef, pk: unknown, entity: unknown): void;
|
|
2899
|
+
/**
|
|
2900
|
+
* Marks an entity as dirty.
|
|
2901
|
+
* @param entity - The entity to mark
|
|
2902
|
+
*/
|
|
2653
2903
|
markDirty(entity: unknown): void;
|
|
2904
|
+
/**
|
|
2905
|
+
* Marks an entity as removed.
|
|
2906
|
+
* @param entity - The entity to mark
|
|
2907
|
+
*/
|
|
2654
2908
|
markRemoved(entity: unknown): void;
|
|
2909
|
+
/**
|
|
2910
|
+
* Gets all tracked entities for a table.
|
|
2911
|
+
* @param table - The table definition
|
|
2912
|
+
* @returns Array of tracked entities
|
|
2913
|
+
*/
|
|
2655
2914
|
getEntitiesForTable(table: TableDef): TrackedEntity[];
|
|
2915
|
+
/**
|
|
2916
|
+
* Registers a relation change.
|
|
2917
|
+
* @param root - The root entity
|
|
2918
|
+
* @param relationKey - The relation key
|
|
2919
|
+
* @param rootTable - The root table definition
|
|
2920
|
+
* @param relationName - The relation name
|
|
2921
|
+
* @param relation - The relation definition
|
|
2922
|
+
* @param change - The relation change
|
|
2923
|
+
*/
|
|
2656
2924
|
registerRelationChange(root: unknown, relationKey: RelationKey, rootTable: TableDef, relationName: string, relation: RelationDef, change: RelationChange<unknown>): void;
|
|
2657
2925
|
}
|
|
2658
2926
|
|
|
@@ -2890,23 +3158,23 @@ declare class OrmSession<E extends DomainEvent = OrmDomainEvent> implements Enti
|
|
|
2890
3158
|
type SelectDialectInput = Dialect | DialectKey;
|
|
2891
3159
|
|
|
2892
3160
|
type ColumnSelectionValue = ColumnDef | FunctionNode | CaseExpressionNode | WindowFunctionNode;
|
|
2893
|
-
type
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
3161
|
+
type DeepSelectEntry<TTable extends TableDef> = {
|
|
3162
|
+
type: 'root';
|
|
3163
|
+
columns: (keyof TTable['columns'] & string)[];
|
|
3164
|
+
} | {
|
|
3165
|
+
type: 'relation';
|
|
3166
|
+
relationName: keyof TTable['relations'] & string;
|
|
3167
|
+
columns: string[];
|
|
2897
3168
|
};
|
|
3169
|
+
type DeepSelectConfig<TTable extends TableDef> = DeepSelectEntry<TTable>[];
|
|
2898
3170
|
type WhereHasOptions = {
|
|
2899
3171
|
correlate?: ExpressionNode;
|
|
2900
3172
|
};
|
|
2901
3173
|
type RelationCallback = <TChildTable extends TableDef>(qb: SelectQueryBuilder<unknown, TChildTable>) => SelectQueryBuilder<unknown, TChildTable>;
|
|
2902
3174
|
/**
|
|
2903
|
-
|
|
2904
3175
|
* Main query builder class for constructing SQL SELECT queries
|
|
2905
|
-
|
|
2906
3176
|
* @typeParam T - Result type for projections (unused)
|
|
2907
|
-
|
|
2908
3177
|
* @typeParam TTable - Table definition being queried
|
|
2909
|
-
|
|
2910
3178
|
*/
|
|
2911
3179
|
declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef> {
|
|
2912
3180
|
private readonly env;
|
|
@@ -2915,82 +3183,89 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
2915
3183
|
private readonly relationManager;
|
|
2916
3184
|
private readonly lazyRelations;
|
|
2917
3185
|
/**
|
|
2918
|
-
|
|
2919
3186
|
* Creates a new SelectQueryBuilder instance
|
|
2920
|
-
|
|
2921
3187
|
* @param table - Table definition to query
|
|
2922
|
-
|
|
2923
3188
|
* @param state - Optional initial query state
|
|
2924
|
-
|
|
2925
3189
|
* @param hydration - Optional hydration manager
|
|
2926
|
-
|
|
2927
3190
|
* @param dependencies - Optional query builder dependencies
|
|
2928
|
-
|
|
2929
3191
|
*/
|
|
2930
3192
|
constructor(table: TTable, state?: SelectQueryState, hydration?: HydrationManager, dependencies?: Partial<SelectQueryBuilderDependencies>, lazyRelations?: Set<string>);
|
|
3193
|
+
/**
|
|
3194
|
+
* Creates a new SelectQueryBuilder instance with updated context and lazy relations
|
|
3195
|
+
* @param context - Updated query context
|
|
3196
|
+
* @param lazyRelations - Updated lazy relations set
|
|
3197
|
+
* @returns New SelectQueryBuilder instance
|
|
3198
|
+
*/
|
|
2931
3199
|
private clone;
|
|
2932
3200
|
/**
|
|
2933
3201
|
* Applies an alias to the root FROM table.
|
|
2934
3202
|
* @param alias - Alias to apply
|
|
2935
3203
|
*/
|
|
2936
3204
|
as(alias: string): SelectQueryBuilder<T, TTable>;
|
|
2937
|
-
|
|
3205
|
+
/**
|
|
3206
|
+
* Applies correlation expression to the query AST
|
|
3207
|
+
* @param ast - Query AST to modify
|
|
3208
|
+
* @param correlation - Correlation expression
|
|
3209
|
+
* @returns Modified AST with correlation applied
|
|
3210
|
+
*/
|
|
2938
3211
|
private applyCorrelation;
|
|
3212
|
+
/**
|
|
3213
|
+
* Creates a new child query builder for a related table
|
|
3214
|
+
* @param table - Table definition for the child builder
|
|
3215
|
+
* @returns New SelectQueryBuilder instance for the child table
|
|
3216
|
+
*/
|
|
2939
3217
|
private createChildBuilder;
|
|
3218
|
+
/**
|
|
3219
|
+
* Applies an AST mutation using the query AST service
|
|
3220
|
+
* @param context - Current query context
|
|
3221
|
+
* @param mutator - Function that mutates the AST
|
|
3222
|
+
* @returns Updated query context
|
|
3223
|
+
*/
|
|
2940
3224
|
private applyAst;
|
|
3225
|
+
/**
|
|
3226
|
+
* Applies a join to the query context
|
|
3227
|
+
* @param context - Current query context
|
|
3228
|
+
* @param table - Table to join
|
|
3229
|
+
* @param condition - Join condition
|
|
3230
|
+
* @param kind - Join kind
|
|
3231
|
+
* @returns Updated query context with join applied
|
|
3232
|
+
*/
|
|
2941
3233
|
private applyJoin;
|
|
3234
|
+
/**
|
|
3235
|
+
* Applies a set operation to the query
|
|
3236
|
+
* @param operator - Set operation kind
|
|
3237
|
+
* @param query - Query to combine with
|
|
3238
|
+
* @returns Updated query context with set operation
|
|
3239
|
+
*/
|
|
2942
3240
|
private applySetOperation;
|
|
2943
3241
|
/**
|
|
2944
|
-
|
|
2945
|
-
*
|
|
2946
|
-
|
|
2947
|
-
* @param columns - Record of column definitions, function nodes, case expressions, or window functions
|
|
2948
|
-
|
|
3242
|
+
* Selects columns for the query (unified overloaded method).
|
|
3243
|
+
* Can be called with column names or a projection object.
|
|
3244
|
+
* @param args - Column names or projection object
|
|
2949
3245
|
* @returns New query builder instance with selected columns
|
|
2950
|
-
|
|
2951
3246
|
*/
|
|
3247
|
+
select<K extends keyof TTable['columns'] & string>(...args: K[]): SelectQueryBuilder<T, TTable>;
|
|
2952
3248
|
select(columns: Record<string, ColumnSelectionValue>): SelectQueryBuilder<T, TTable>;
|
|
2953
3249
|
/**
|
|
2954
|
-
* Selects columns from the root table by name (typed).
|
|
2955
|
-
* @param cols - Column names on the root table
|
|
2956
|
-
*/
|
|
2957
|
-
selectColumns<K extends keyof TTable['columns'] & string>(...cols: K[]): SelectQueryBuilder<T, TTable>;
|
|
2958
|
-
/**
|
|
2959
|
-
|
|
2960
3250
|
* Selects raw column expressions
|
|
2961
|
-
|
|
2962
3251
|
* @param cols - Column expressions as strings
|
|
2963
|
-
|
|
2964
3252
|
* @returns New query builder instance with raw column selections
|
|
2965
|
-
|
|
2966
3253
|
*/
|
|
2967
3254
|
selectRaw(...cols: string[]): SelectQueryBuilder<T, TTable>;
|
|
2968
3255
|
/**
|
|
2969
|
-
|
|
2970
3256
|
* Adds a Common Table Expression (CTE) to the query
|
|
2971
|
-
|
|
2972
3257
|
* @param name - Name of the CTE
|
|
2973
|
-
|
|
2974
3258
|
* @param query - Query builder or query node for the CTE
|
|
2975
|
-
|
|
2976
3259
|
* @param columns - Optional column names for the CTE
|
|
2977
|
-
|
|
2978
3260
|
* @returns New query builder instance with the CTE
|
|
2979
|
-
|
|
2980
3261
|
*/
|
|
2981
3262
|
with<TSub extends TableDef>(name: string, query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, columns?: string[]): SelectQueryBuilder<T, TTable>;
|
|
2982
3263
|
/**
|
|
2983
|
-
|
|
2984
3264
|
* Adds a recursive Common Table Expression (CTE) to the query
|
|
2985
|
-
|
|
2986
3265
|
* @param name - Name of the CTE
|
|
2987
|
-
|
|
2988
3266
|
* @param query - Query builder or query node for the CTE
|
|
2989
|
-
|
|
2990
3267
|
* @param columns - Optional column names for the CTE
|
|
2991
|
-
|
|
2992
3268
|
* @returns New query builder instance with the recursive CTE
|
|
2993
|
-
|
|
2994
3269
|
*/
|
|
2995
3270
|
withRecursive<TSub extends TableDef>(name: string, query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, columns?: string[]): SelectQueryBuilder<T, TTable>;
|
|
2996
3271
|
/**
|
|
@@ -3002,15 +3277,23 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3002
3277
|
*/
|
|
3003
3278
|
fromSubquery<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, alias: string, columnAliases?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3004
3279
|
/**
|
|
3005
|
-
|
|
3280
|
+
* Replaces the FROM clause with a function table expression.
|
|
3281
|
+
* @param name - Function name
|
|
3282
|
+
* @param args - Optional function arguments
|
|
3283
|
+
* @param alias - Optional alias for the function table
|
|
3284
|
+
* @param options - Optional function-table metadata (lateral, ordinality, column aliases, schema)
|
|
3285
|
+
*/
|
|
3286
|
+
fromFunctionTable(name: string, args?: OperandNode[], alias?: string, options?: {
|
|
3287
|
+
lateral?: boolean;
|
|
3288
|
+
withOrdinality?: boolean;
|
|
3289
|
+
columnAliases?: string[];
|
|
3290
|
+
schema?: string;
|
|
3291
|
+
}): SelectQueryBuilder<T, TTable>;
|
|
3292
|
+
/**
|
|
3006
3293
|
* Selects a subquery as a column
|
|
3007
|
-
|
|
3008
3294
|
* @param alias - Alias for the subquery column
|
|
3009
|
-
|
|
3010
3295
|
* @param sub - Query builder or query node for the subquery
|
|
3011
|
-
|
|
3012
3296
|
* @returns New query builder instance with the subquery selection
|
|
3013
|
-
|
|
3014
3297
|
*/
|
|
3015
3298
|
selectSubquery<TSub extends TableDef>(alias: string, sub: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3016
3299
|
/**
|
|
@@ -3024,79 +3307,68 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3024
3307
|
*/
|
|
3025
3308
|
joinSubquery<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, alias: string, condition: BinaryExpressionNode, joinKind?: JoinKind, columnAliases?: string[]): SelectQueryBuilder<T, TTable>;
|
|
3026
3309
|
/**
|
|
3027
|
-
|
|
3310
|
+
* Adds a join against a function table (e.g., `generate_series`) using `fnTable` internally.
|
|
3311
|
+
* @param name - Function name
|
|
3312
|
+
* @param args - Optional arguments passed to the function
|
|
3313
|
+
* @param alias - Alias for the function table so columns can be referenced
|
|
3314
|
+
* @param condition - Join condition expression
|
|
3315
|
+
* @param joinKind - Kind of join (defaults to INNER)
|
|
3316
|
+
* @param options - Optional metadata (lateral, ordinality, column aliases, schema)
|
|
3317
|
+
*/
|
|
3318
|
+
joinFunctionTable(name: string, args: OperandNode[], alias: string, condition: BinaryExpressionNode, joinKind?: JoinKind, options?: {
|
|
3319
|
+
lateral?: boolean;
|
|
3320
|
+
withOrdinality?: boolean;
|
|
3321
|
+
columnAliases?: string[];
|
|
3322
|
+
schema?: string;
|
|
3323
|
+
}): SelectQueryBuilder<T, TTable>;
|
|
3324
|
+
/**
|
|
3028
3325
|
* Adds an INNER JOIN to the query
|
|
3029
|
-
|
|
3030
3326
|
* @param table - Table to join
|
|
3031
|
-
|
|
3032
3327
|
* @param condition - Join condition expression
|
|
3033
|
-
|
|
3034
3328
|
* @returns New query builder instance with the INNER JOIN
|
|
3035
|
-
|
|
3036
3329
|
*/
|
|
3037
3330
|
innerJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3038
3331
|
/**
|
|
3039
|
-
|
|
3040
3332
|
* Adds a LEFT JOIN to the query
|
|
3041
|
-
|
|
3042
3333
|
* @param table - Table to join
|
|
3043
|
-
|
|
3044
3334
|
* @param condition - Join condition expression
|
|
3045
|
-
|
|
3046
3335
|
* @returns New query builder instance with the LEFT JOIN
|
|
3047
|
-
|
|
3048
3336
|
*/
|
|
3049
3337
|
leftJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3050
3338
|
/**
|
|
3051
|
-
|
|
3052
3339
|
* Adds a RIGHT JOIN to the query
|
|
3053
|
-
|
|
3054
3340
|
* @param table - Table to join
|
|
3055
|
-
|
|
3056
3341
|
* @param condition - Join condition expression
|
|
3057
|
-
|
|
3058
3342
|
* @returns New query builder instance with the RIGHT JOIN
|
|
3059
|
-
|
|
3060
3343
|
*/
|
|
3061
3344
|
rightJoin(table: TableDef, condition: BinaryExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3062
3345
|
/**
|
|
3063
|
-
|
|
3064
3346
|
* Matches records based on a relationship
|
|
3065
|
-
|
|
3066
3347
|
* @param relationName - Name of the relationship to match
|
|
3067
|
-
|
|
3068
3348
|
* @param predicate - Optional predicate expression
|
|
3069
|
-
|
|
3070
3349
|
* @returns New query builder instance with the relationship match
|
|
3071
|
-
|
|
3072
3350
|
*/
|
|
3073
|
-
match(relationName:
|
|
3351
|
+
match<K extends keyof TTable['relations'] & string>(relationName: K, predicate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3074
3352
|
/**
|
|
3075
|
-
|
|
3076
3353
|
* Joins a related table
|
|
3077
|
-
|
|
3078
3354
|
* @param relationName - Name of the relationship to join
|
|
3079
|
-
|
|
3080
3355
|
* @param joinKind - Type of join (defaults to INNER)
|
|
3081
|
-
|
|
3082
3356
|
* @param extraCondition - Optional additional join condition
|
|
3083
|
-
|
|
3084
3357
|
* @returns New query builder instance with the relationship join
|
|
3085
|
-
|
|
3086
3358
|
*/
|
|
3087
|
-
joinRelation(relationName:
|
|
3359
|
+
joinRelation<K extends keyof TTable['relations'] & string>(relationName: K, joinKind?: JoinKind, extraCondition?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3088
3360
|
/**
|
|
3089
|
-
|
|
3090
3361
|
* Includes related data in the query results
|
|
3091
|
-
|
|
3092
3362
|
* @param relationName - Name of the relationship to include
|
|
3093
|
-
|
|
3094
3363
|
* @param options - Optional include options
|
|
3095
|
-
|
|
3096
3364
|
* @returns New query builder instance with the relationship inclusion
|
|
3097
|
-
|
|
3098
3365
|
*/
|
|
3099
|
-
include(relationName:
|
|
3366
|
+
include<K extends keyof TTable['relations'] & string>(relationName: K, options?: RelationIncludeOptions): SelectQueryBuilder<T, TTable>;
|
|
3367
|
+
/**
|
|
3368
|
+
* Includes a relation lazily in the query results
|
|
3369
|
+
* @param relationName - Name of the relation to include lazily
|
|
3370
|
+
* @returns New query builder instance with lazy relation inclusion
|
|
3371
|
+
*/
|
|
3100
3372
|
includeLazy<K extends keyof RelationMap<TTable>>(relationName: K): SelectQueryBuilder<T, TTable>;
|
|
3101
3373
|
/**
|
|
3102
3374
|
* Selects columns for a related table in a single hop.
|
|
@@ -3107,21 +3379,38 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3107
3379
|
*/
|
|
3108
3380
|
includePick<K extends keyof TTable['relations'] & string, TRel extends RelationDef = TTable['relations'][K], TTarget extends TableDef = RelationTargetTable<TRel>, C extends keyof TTarget['columns'] & string = keyof TTarget['columns'] & string>(relationName: K, cols: C[]): SelectQueryBuilder<T, TTable>;
|
|
3109
3381
|
/**
|
|
3110
|
-
* Selects columns for the root table and relations from
|
|
3382
|
+
* Selects columns for the root table and relations from an array of entries
|
|
3383
|
+
* @param config - Configuration array for deep column selection
|
|
3384
|
+
* @returns New query builder instance with deep column selections
|
|
3111
3385
|
*/
|
|
3112
3386
|
selectColumnsDeep(config: DeepSelectConfig<TTable>): SelectQueryBuilder<T, TTable>;
|
|
3387
|
+
/**
|
|
3388
|
+
* Gets the list of lazy relations
|
|
3389
|
+
* @returns Array of lazy relation names
|
|
3390
|
+
*/
|
|
3113
3391
|
getLazyRelations(): (keyof RelationMap<TTable>)[];
|
|
3392
|
+
/**
|
|
3393
|
+
* Gets the table definition for this query builder
|
|
3394
|
+
* @returns Table definition
|
|
3395
|
+
*/
|
|
3114
3396
|
getTable(): TTable;
|
|
3397
|
+
/**
|
|
3398
|
+
* Executes the query and returns hydrated results
|
|
3399
|
+
* @param ctx - ORM session context
|
|
3400
|
+
* @returns Promise of entity instances
|
|
3401
|
+
*/
|
|
3115
3402
|
execute(ctx: OrmSession): Promise<EntityInstance<TTable>[]>;
|
|
3403
|
+
/**
|
|
3404
|
+
* Executes the query with provided execution and hydration contexts
|
|
3405
|
+
* @param execCtx - Execution context
|
|
3406
|
+
* @param hydCtx - Hydration context
|
|
3407
|
+
* @returns Promise of entity instances
|
|
3408
|
+
*/
|
|
3116
3409
|
executeWithContexts(execCtx: ExecutionContext, hydCtx: HydrationContext): Promise<EntityInstance<TTable>[]>;
|
|
3117
3410
|
/**
|
|
3118
|
-
|
|
3119
3411
|
* Adds a WHERE condition to the query
|
|
3120
|
-
|
|
3121
3412
|
* @param expr - Expression for the WHERE clause
|
|
3122
|
-
|
|
3123
3413
|
* @returns New query builder instance with the WHERE condition
|
|
3124
|
-
|
|
3125
3414
|
*/
|
|
3126
3415
|
where(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3127
3416
|
/**
|
|
@@ -3131,13 +3420,9 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3131
3420
|
*/
|
|
3132
3421
|
groupBy(term: ColumnDef | OrderingTerm): SelectQueryBuilder<T, TTable>;
|
|
3133
3422
|
/**
|
|
3134
|
-
|
|
3135
3423
|
* Adds a HAVING condition to the query
|
|
3136
|
-
|
|
3137
3424
|
* @param expr - Expression for the HAVING clause
|
|
3138
|
-
|
|
3139
3425
|
* @returns New query builder instance with the HAVING condition
|
|
3140
|
-
|
|
3141
3426
|
*/
|
|
3142
3427
|
having(expr: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3143
3428
|
/**
|
|
@@ -3152,181 +3437,105 @@ declare class SelectQueryBuilder<T = unknown, TTable extends TableDef = TableDef
|
|
|
3152
3437
|
collation?: string;
|
|
3153
3438
|
}): SelectQueryBuilder<T, TTable>;
|
|
3154
3439
|
/**
|
|
3155
|
-
|
|
3156
3440
|
* Adds a DISTINCT clause to the query
|
|
3157
|
-
|
|
3158
3441
|
* @param cols - Columns to make distinct
|
|
3159
|
-
|
|
3160
3442
|
* @returns New query builder instance with the DISTINCT clause
|
|
3161
|
-
|
|
3162
3443
|
*/
|
|
3163
3444
|
distinct(...cols: (ColumnDef | ColumnNode)[]): SelectQueryBuilder<T, TTable>;
|
|
3164
3445
|
/**
|
|
3165
|
-
|
|
3166
3446
|
* Adds a LIMIT clause to the query
|
|
3167
|
-
|
|
3168
3447
|
* @param n - Maximum number of rows to return
|
|
3169
|
-
|
|
3170
3448
|
* @returns New query builder instance with the LIMIT clause
|
|
3171
|
-
|
|
3172
3449
|
*/
|
|
3173
3450
|
limit(n: number): SelectQueryBuilder<T, TTable>;
|
|
3174
3451
|
/**
|
|
3175
|
-
|
|
3176
3452
|
* Adds an OFFSET clause to the query
|
|
3177
|
-
|
|
3178
3453
|
* @param n - Number of rows to skip
|
|
3179
|
-
|
|
3180
3454
|
* @returns New query builder instance with the OFFSET clause
|
|
3181
|
-
|
|
3182
3455
|
*/
|
|
3183
3456
|
offset(n: number): SelectQueryBuilder<T, TTable>;
|
|
3184
3457
|
/**
|
|
3185
|
-
|
|
3186
3458
|
* Combines this query with another using UNION
|
|
3187
|
-
|
|
3188
3459
|
* @param query - Query to union with
|
|
3189
|
-
|
|
3190
3460
|
* @returns New query builder instance with the set operation
|
|
3191
|
-
|
|
3192
3461
|
*/
|
|
3193
3462
|
union<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3194
3463
|
/**
|
|
3195
|
-
|
|
3196
3464
|
* Combines this query with another using UNION ALL
|
|
3197
|
-
|
|
3198
3465
|
* @param query - Query to union with
|
|
3199
|
-
|
|
3200
3466
|
* @returns New query builder instance with the set operation
|
|
3201
|
-
|
|
3202
3467
|
*/
|
|
3203
3468
|
unionAll<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3204
3469
|
/**
|
|
3205
|
-
|
|
3206
3470
|
* Combines this query with another using INTERSECT
|
|
3207
|
-
|
|
3208
3471
|
* @param query - Query to intersect with
|
|
3209
|
-
|
|
3210
3472
|
* @returns New query builder instance with the set operation
|
|
3211
|
-
|
|
3212
3473
|
*/
|
|
3213
3474
|
intersect<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3214
3475
|
/**
|
|
3215
|
-
|
|
3216
3476
|
* Combines this query with another using EXCEPT
|
|
3217
|
-
|
|
3218
3477
|
* @param query - Query to subtract
|
|
3219
|
-
|
|
3220
3478
|
* @returns New query builder instance with the set operation
|
|
3221
|
-
|
|
3222
3479
|
*/
|
|
3223
3480
|
except<TSub extends TableDef>(query: SelectQueryBuilder<unknown, TSub> | SelectQueryNode): SelectQueryBuilder<T, TTable>;
|
|
3224
3481
|
/**
|
|
3225
|
-
|
|
3226
3482
|
* Adds a WHERE EXISTS condition to the query
|
|
3227
|
-
|
|
3228
3483
|
* @param subquery - Subquery to check for existence
|
|
3229
|
-
|
|
3230
3484
|
* @returns New query builder instance with the WHERE EXISTS condition
|
|
3231
|
-
|
|
3232
3485
|
*/
|
|
3233
3486
|
whereExists<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, correlate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3234
3487
|
/**
|
|
3235
|
-
|
|
3236
3488
|
* Adds a WHERE NOT EXISTS condition to the query
|
|
3237
|
-
|
|
3238
3489
|
* @param subquery - Subquery to check for non-existence
|
|
3239
|
-
|
|
3240
3490
|
* @returns New query builder instance with the WHERE NOT EXISTS condition
|
|
3241
|
-
|
|
3242
3491
|
*/
|
|
3243
3492
|
whereNotExists<TSub extends TableDef>(subquery: SelectQueryBuilder<unknown, TSub> | SelectQueryNode, correlate?: ExpressionNode): SelectQueryBuilder<T, TTable>;
|
|
3244
3493
|
/**
|
|
3245
|
-
|
|
3246
3494
|
* Adds a WHERE EXISTS condition based on a relationship
|
|
3247
|
-
|
|
3248
3495
|
* @param relationName - Name of the relationship to check
|
|
3249
|
-
|
|
3250
3496
|
* @param callback - Optional callback to modify the relationship query
|
|
3251
|
-
|
|
3252
3497
|
* @returns New query builder instance with the relationship existence check
|
|
3253
|
-
|
|
3254
3498
|
*/
|
|
3255
|
-
whereHas(relationName:
|
|
3499
|
+
whereHas<K extends keyof TTable['relations'] & string>(relationName: K, callbackOrOptions?: RelationCallback | WhereHasOptions, maybeOptions?: WhereHasOptions): SelectQueryBuilder<T, TTable>;
|
|
3256
3500
|
/**
|
|
3257
|
-
|
|
3258
3501
|
* Adds a WHERE NOT EXISTS condition based on a relationship
|
|
3259
|
-
|
|
3260
3502
|
* @param relationName - Name of the relationship to check
|
|
3261
|
-
|
|
3262
3503
|
* @param callback - Optional callback to modify the relationship query
|
|
3263
|
-
|
|
3264
3504
|
* @returns New query builder instance with the relationship non-existence check
|
|
3265
|
-
|
|
3266
3505
|
*/
|
|
3267
|
-
whereHasNot(relationName:
|
|
3506
|
+
whereHasNot<K extends keyof TTable['relations'] & string>(relationName: K, callbackOrOptions?: RelationCallback | WhereHasOptions, maybeOptions?: WhereHasOptions): SelectQueryBuilder<T, TTable>;
|
|
3268
3507
|
/**
|
|
3269
|
-
|
|
3270
3508
|
* Compiles the query to SQL for a specific dialect
|
|
3271
|
-
|
|
3272
3509
|
* @param dialect - Database dialect to compile for
|
|
3273
|
-
|
|
3274
3510
|
* @returns Compiled query with SQL and parameters
|
|
3275
|
-
|
|
3276
3511
|
*/
|
|
3277
3512
|
compile(dialect: SelectDialectInput): CompiledQuery;
|
|
3278
3513
|
/**
|
|
3279
|
-
|
|
3280
3514
|
* Converts the query to SQL string for a specific dialect
|
|
3281
|
-
|
|
3282
3515
|
* @param dialect - Database dialect to generate SQL for
|
|
3283
|
-
|
|
3284
3516
|
* @returns SQL string representation of the query
|
|
3285
|
-
|
|
3286
3517
|
*/
|
|
3287
3518
|
toSql(dialect: SelectDialectInput): string;
|
|
3288
3519
|
/**
|
|
3289
|
-
|
|
3290
3520
|
* Gets the hydration plan for the query
|
|
3291
|
-
|
|
3292
3521
|
* @returns Hydration plan or undefined if none exists
|
|
3293
|
-
|
|
3294
3522
|
*/
|
|
3295
3523
|
getHydrationPlan(): HydrationPlan | undefined;
|
|
3296
3524
|
/**
|
|
3297
|
-
|
|
3298
3525
|
* Gets the Abstract Syntax Tree (AST) representation of the query
|
|
3299
|
-
|
|
3300
3526
|
* @returns Query AST with hydration applied
|
|
3301
|
-
|
|
3302
3527
|
*/
|
|
3303
3528
|
getAST(): SelectQueryNode;
|
|
3304
3529
|
}
|
|
3305
|
-
/**
|
|
3306
|
-
|
|
3307
|
-
* Creates a column node for use in expressions
|
|
3308
|
-
|
|
3309
|
-
* @param table - Table name
|
|
3310
|
-
|
|
3311
|
-
* @param name - Column name
|
|
3312
|
-
|
|
3313
|
-
* @returns ColumnNode with the specified table and name
|
|
3314
|
-
|
|
3315
|
-
*/
|
|
3316
|
-
declare const createColumn: (table: string, name: string) => ColumnNode;
|
|
3317
|
-
/**
|
|
3318
|
-
|
|
3319
|
-
* Creates a literal value node for use in expressions
|
|
3320
|
-
|
|
3321
|
-
* @param val - Literal value (string or number)
|
|
3322
|
-
|
|
3323
|
-
* @returns LiteralNode with the specified value
|
|
3324
|
-
|
|
3325
|
-
*/
|
|
3326
|
-
declare const createLiteral: (val: string | number) => LiteralNode;
|
|
3327
3530
|
|
|
3328
3531
|
/**
|
|
3329
3532
|
* Build a typed selection map from a TableDef.
|
|
3533
|
+
* @template TTable - The table definition type
|
|
3534
|
+
* @template K - The column name keys
|
|
3535
|
+
* @param table - The table definition to select columns from
|
|
3536
|
+
* @param cols - Column names to include in the selection
|
|
3537
|
+
* @returns A typed record mapping column names to their definitions
|
|
3538
|
+
* @throws Error if a specified column is not found on the table
|
|
3330
3539
|
*/
|
|
3331
3540
|
declare function sel<TTable extends TableDef, K extends keyof TTable['columns'] & string>(table: TTable, ...cols: K[]): Record<K, TTable['columns'][K]>;
|
|
3332
3541
|
type Ctor<T> = {
|
|
@@ -3334,6 +3543,13 @@ type Ctor<T> = {
|
|
|
3334
3543
|
};
|
|
3335
3544
|
/**
|
|
3336
3545
|
* Build a typed selection map from an entity constructor.
|
|
3546
|
+
* @template TEntity - The entity type
|
|
3547
|
+
* @template K - The property name keys
|
|
3548
|
+
* @param entity - The entity constructor to get table definition from
|
|
3549
|
+
* @param props - Property names to include in the selection
|
|
3550
|
+
* @returns A record mapping property names to their column definitions
|
|
3551
|
+
* @throws Error if no table definition is registered for the entity
|
|
3552
|
+
* @throws Error if a specified property is not found as a column
|
|
3337
3553
|
*/
|
|
3338
3554
|
declare function esel<TEntity extends object, K extends keyof TEntity & string>(entity: Ctor<TEntity>, ...props: K[]): Record<K, ColumnDef>;
|
|
3339
3555
|
|
|
@@ -3343,14 +3559,44 @@ declare function esel<TEntity extends object, K extends keyof TEntity & string>(
|
|
|
3343
3559
|
declare class InsertQueryState {
|
|
3344
3560
|
readonly table: TableDef;
|
|
3345
3561
|
readonly ast: InsertQueryNode;
|
|
3562
|
+
/**
|
|
3563
|
+
* Creates a new InsertQueryState instance
|
|
3564
|
+
* @param table - The table definition for the INSERT query
|
|
3565
|
+
* @param ast - Optional initial AST node, defaults to a basic INSERT query
|
|
3566
|
+
*/
|
|
3346
3567
|
constructor(table: TableDef, ast?: InsertQueryNode);
|
|
3347
3568
|
private clone;
|
|
3348
3569
|
private ensureColumnsFromRow;
|
|
3349
3570
|
private appendValues;
|
|
3350
3571
|
private getTableColumns;
|
|
3572
|
+
/**
|
|
3573
|
+
* Adds VALUES clause to the INSERT query
|
|
3574
|
+
* @param rows - Array of row objects to insert
|
|
3575
|
+
* @returns A new InsertQueryState with the VALUES clause added
|
|
3576
|
+
* @throws Error if mixing VALUES with SELECT source
|
|
3577
|
+
* @throws Error if invalid values are provided
|
|
3578
|
+
*/
|
|
3351
3579
|
withValues(rows: Record<string, unknown>[]): InsertQueryState;
|
|
3580
|
+
/**
|
|
3581
|
+
* Sets the columns for the INSERT query
|
|
3582
|
+
* @param columns - Column nodes to insert into
|
|
3583
|
+
* @returns A new InsertQueryState with the specified columns
|
|
3584
|
+
*/
|
|
3352
3585
|
withColumns(columns: ColumnNode[]): InsertQueryState;
|
|
3586
|
+
/**
|
|
3587
|
+
* Adds SELECT source to the INSERT query
|
|
3588
|
+
* @param query - The SELECT query to use as source
|
|
3589
|
+
* @param columns - Target columns for the INSERT
|
|
3590
|
+
* @returns A new InsertQueryState with the SELECT source
|
|
3591
|
+
* @throws Error if mixing SELECT with VALUES source
|
|
3592
|
+
* @throws Error if no destination columns specified
|
|
3593
|
+
*/
|
|
3353
3594
|
withSelect(query: SelectQueryNode, columns: ColumnNode[]): InsertQueryState;
|
|
3595
|
+
/**
|
|
3596
|
+
* Adds a RETURNING clause to the INSERT query
|
|
3597
|
+
* @param columns - Columns to return after insertion
|
|
3598
|
+
* @returns A new InsertQueryState with the RETURNING clause added
|
|
3599
|
+
*/
|
|
3354
3600
|
withReturning(columns: ColumnNode[]): InsertQueryState;
|
|
3355
3601
|
}
|
|
3356
3602
|
|
|
@@ -3361,17 +3607,63 @@ type InsertDialectInput = Dialect | DialectKey;
|
|
|
3361
3607
|
declare class InsertQueryBuilder<T> {
|
|
3362
3608
|
private readonly table;
|
|
3363
3609
|
private readonly state;
|
|
3610
|
+
/**
|
|
3611
|
+
* Creates a new InsertQueryBuilder instance
|
|
3612
|
+
* @param table - The table definition for the INSERT query
|
|
3613
|
+
* @param state - Optional initial query state, defaults to a new InsertQueryState
|
|
3614
|
+
*/
|
|
3364
3615
|
constructor(table: TableDef, state?: InsertQueryState);
|
|
3365
3616
|
private clone;
|
|
3617
|
+
/**
|
|
3618
|
+
* Adds VALUES to the INSERT query
|
|
3619
|
+
* @param rowOrRows - Single row object or array of row objects to insert
|
|
3620
|
+
* @returns A new InsertQueryBuilder with the VALUES clause added
|
|
3621
|
+
*/
|
|
3366
3622
|
values(rowOrRows: Record<string, unknown> | Record<string, unknown>[]): InsertQueryBuilder<T>;
|
|
3623
|
+
/**
|
|
3624
|
+
* Specifies the columns for the INSERT query
|
|
3625
|
+
* @param columns - Column definitions or nodes to insert into
|
|
3626
|
+
* @returns A new InsertQueryBuilder with the specified columns
|
|
3627
|
+
*/
|
|
3367
3628
|
columns(...columns: (ColumnDef | ColumnNode)[]): InsertQueryBuilder<T>;
|
|
3629
|
+
/**
|
|
3630
|
+
* Sets the source of the INSERT query to a SELECT query
|
|
3631
|
+
* @template TSource - The source table type
|
|
3632
|
+
* @param query - The SELECT query or query builder to use as source
|
|
3633
|
+
* @param columns - Optional target columns for the INSERT
|
|
3634
|
+
* @returns A new InsertQueryBuilder with the SELECT source
|
|
3635
|
+
*/
|
|
3368
3636
|
fromSelect<TSource extends TableDef>(query: SelectQueryNode | SelectQueryBuilder<unknown, TSource>, columns?: (ColumnDef | ColumnNode)[]): InsertQueryBuilder<T>;
|
|
3637
|
+
/**
|
|
3638
|
+
* Adds a RETURNING clause to the INSERT query
|
|
3639
|
+
* @param columns - Columns to return after insertion
|
|
3640
|
+
* @returns A new InsertQueryBuilder with the RETURNING clause added
|
|
3641
|
+
*/
|
|
3369
3642
|
returning(...columns: (ColumnDef | ColumnNode)[]): InsertQueryBuilder<T>;
|
|
3370
3643
|
private resolveColumnNodes;
|
|
3371
3644
|
private resolveSelectQuery;
|
|
3645
|
+
/**
|
|
3646
|
+
* Compiles the INSERT query
|
|
3647
|
+
* @param compiler - The INSERT compiler to use
|
|
3648
|
+
* @returns The compiled query with SQL and parameters
|
|
3649
|
+
*/
|
|
3372
3650
|
compile(compiler: InsertCompiler): CompiledQuery;
|
|
3651
|
+
/**
|
|
3652
|
+
* Compiles the INSERT query for the specified dialect
|
|
3653
|
+
* @param dialect - The SQL dialect to compile for
|
|
3654
|
+
* @returns The compiled query with SQL and parameters
|
|
3655
|
+
*/
|
|
3373
3656
|
compile(dialect: InsertDialectInput): CompiledQuery;
|
|
3657
|
+
/**
|
|
3658
|
+
* Returns the SQL string for the INSERT query
|
|
3659
|
+
* @param arg - The compiler or dialect to generate SQL for
|
|
3660
|
+
* @returns The SQL string representation of the query
|
|
3661
|
+
*/
|
|
3374
3662
|
toSql(arg: InsertCompiler | InsertDialectInput): string;
|
|
3663
|
+
/**
|
|
3664
|
+
* Returns the Abstract Syntax Tree (AST) representation of the query
|
|
3665
|
+
* @returns The AST node for the INSERT query
|
|
3666
|
+
*/
|
|
3375
3667
|
getAST(): InsertQueryNode;
|
|
3376
3668
|
}
|
|
3377
3669
|
|
|
@@ -3381,13 +3673,53 @@ declare class InsertQueryBuilder<T> {
|
|
|
3381
3673
|
declare class UpdateQueryState {
|
|
3382
3674
|
readonly table: TableDef;
|
|
3383
3675
|
readonly ast: UpdateQueryNode;
|
|
3676
|
+
/**
|
|
3677
|
+
* Creates a new UpdateQueryState instance
|
|
3678
|
+
* @param table - Table definition for the update
|
|
3679
|
+
* @param ast - Optional existing AST
|
|
3680
|
+
*/
|
|
3384
3681
|
constructor(table: TableDef, ast?: UpdateQueryNode);
|
|
3682
|
+
/**
|
|
3683
|
+
* Creates a new UpdateQueryState with updated AST
|
|
3684
|
+
* @param nextAst - Updated AST
|
|
3685
|
+
* @returns New UpdateQueryState instance
|
|
3686
|
+
*/
|
|
3385
3687
|
private clone;
|
|
3688
|
+
/**
|
|
3689
|
+
* Sets the columns to update with their new values
|
|
3690
|
+
* @param values - Record of column names to values
|
|
3691
|
+
* @returns New UpdateQueryState with SET clause
|
|
3692
|
+
*/
|
|
3386
3693
|
withSet(values: Record<string, unknown>): UpdateQueryState;
|
|
3694
|
+
/**
|
|
3695
|
+
* Adds a WHERE condition to the update query
|
|
3696
|
+
* @param expr - WHERE expression
|
|
3697
|
+
* @returns New UpdateQueryState with WHERE clause
|
|
3698
|
+
*/
|
|
3387
3699
|
withWhere(expr: ExpressionNode): UpdateQueryState;
|
|
3700
|
+
/**
|
|
3701
|
+
* Adds a RETURNING clause to the update query
|
|
3702
|
+
* @param columns - Columns to return
|
|
3703
|
+
* @returns New UpdateQueryState with RETURNING clause
|
|
3704
|
+
*/
|
|
3388
3705
|
withReturning(columns: ColumnNode[]): UpdateQueryState;
|
|
3706
|
+
/**
|
|
3707
|
+
* Sets the FROM clause for the update query
|
|
3708
|
+
* @param from - Table source for FROM
|
|
3709
|
+
* @returns New UpdateQueryState with FROM clause
|
|
3710
|
+
*/
|
|
3389
3711
|
withFrom(from: TableSourceNode): UpdateQueryState;
|
|
3712
|
+
/**
|
|
3713
|
+
* Adds a JOIN to the update query
|
|
3714
|
+
* @param join - Join node to add
|
|
3715
|
+
* @returns New UpdateQueryState with JOIN
|
|
3716
|
+
*/
|
|
3390
3717
|
withJoin(join: JoinNode): UpdateQueryState;
|
|
3718
|
+
/**
|
|
3719
|
+
* Applies an alias to the table being updated
|
|
3720
|
+
* @param alias - Alias for the table
|
|
3721
|
+
* @returns New UpdateQueryState with table alias
|
|
3722
|
+
*/
|
|
3391
3723
|
withTableAlias(alias: string): UpdateQueryState;
|
|
3392
3724
|
}
|
|
3393
3725
|
|
|
@@ -3398,19 +3730,76 @@ type UpdateDialectInput = Dialect | DialectKey;
|
|
|
3398
3730
|
declare class UpdateQueryBuilder<T> {
|
|
3399
3731
|
private readonly table;
|
|
3400
3732
|
private readonly state;
|
|
3733
|
+
/**
|
|
3734
|
+
* Creates a new UpdateQueryBuilder instance
|
|
3735
|
+
* @param table - The table definition for the UPDATE query
|
|
3736
|
+
* @param state - Optional initial query state, defaults to a new UpdateQueryState
|
|
3737
|
+
*/
|
|
3401
3738
|
constructor(table: TableDef, state?: UpdateQueryState);
|
|
3402
3739
|
private clone;
|
|
3740
|
+
/**
|
|
3741
|
+
* Sets an alias for the table in the UPDATE query
|
|
3742
|
+
* @param alias - The alias to assign to the table
|
|
3743
|
+
* @returns A new UpdateQueryBuilder with the table alias set
|
|
3744
|
+
*/
|
|
3403
3745
|
as(alias: string): UpdateQueryBuilder<T>;
|
|
3746
|
+
/**
|
|
3747
|
+
* Adds a FROM clause to the UPDATE query
|
|
3748
|
+
* @param source - The table source to use in the FROM clause
|
|
3749
|
+
* @returns A new UpdateQueryBuilder with the FROM clause added
|
|
3750
|
+
*/
|
|
3404
3751
|
from(source: TableDef | TableSourceNode): UpdateQueryBuilder<T>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Adds a JOIN clause to the UPDATE query
|
|
3754
|
+
* @param table - The table to join with
|
|
3755
|
+
* @param condition - The join condition expression
|
|
3756
|
+
* @param kind - The type of join (defaults to INNER)
|
|
3757
|
+
* @param relationName - Optional name for the relation
|
|
3758
|
+
* @returns A new UpdateQueryBuilder with the JOIN clause added
|
|
3759
|
+
*/
|
|
3405
3760
|
join(table: TableDef | TableSourceNode | string, condition: ExpressionNode, kind?: JoinKind, relationName?: string): UpdateQueryBuilder<T>;
|
|
3761
|
+
/**
|
|
3762
|
+
* Adds a SET clause to the UPDATE query
|
|
3763
|
+
* @param values - The column-value pairs to update
|
|
3764
|
+
* @returns A new UpdateQueryBuilder with the SET clause added
|
|
3765
|
+
*/
|
|
3406
3766
|
set(values: Record<string, unknown>): UpdateQueryBuilder<T>;
|
|
3767
|
+
/**
|
|
3768
|
+
* Adds a WHERE clause to the UPDATE query
|
|
3769
|
+
* @param expr - The expression to use as the WHERE condition
|
|
3770
|
+
* @returns A new UpdateQueryBuilder with the WHERE clause added
|
|
3771
|
+
*/
|
|
3407
3772
|
where(expr: ExpressionNode): UpdateQueryBuilder<T>;
|
|
3773
|
+
/**
|
|
3774
|
+
* Adds a RETURNING clause to the UPDATE query
|
|
3775
|
+
* @param columns - Columns to return after update
|
|
3776
|
+
* @returns A new UpdateQueryBuilder with the RETURNING clause added
|
|
3777
|
+
*/
|
|
3408
3778
|
returning(...columns: (ColumnDef | ColumnNode)[]): UpdateQueryBuilder<T>;
|
|
3409
3779
|
private resolveTableSource;
|
|
3410
3780
|
private resolveJoinTarget;
|
|
3411
|
-
|
|
3781
|
+
/**
|
|
3782
|
+
* Compiles the UPDATE query for the specified dialect
|
|
3783
|
+
* @param dialect - The SQL dialect to compile for
|
|
3784
|
+
* @returns The compiled query with SQL and parameters
|
|
3785
|
+
*/
|
|
3412
3786
|
compile(dialect: UpdateDialectInput): CompiledQuery;
|
|
3413
|
-
|
|
3787
|
+
/**
|
|
3788
|
+
* Returns the SQL string for the UPDATE query
|
|
3789
|
+
* @param dialect - The SQL dialect to generate SQL for
|
|
3790
|
+
* @returns The SQL string representation of the query
|
|
3791
|
+
*/
|
|
3792
|
+
toSql(dialect: UpdateDialectInput): string;
|
|
3793
|
+
/**
|
|
3794
|
+
* Executes the UPDATE query using the provided session
|
|
3795
|
+
* @param session - The ORM session to execute the query with
|
|
3796
|
+
* @returns A promise that resolves to the query results
|
|
3797
|
+
*/
|
|
3798
|
+
execute(session: OrmSession): Promise<QueryResult[]>;
|
|
3799
|
+
/**
|
|
3800
|
+
* Returns the Abstract Syntax Tree (AST) representation of the query
|
|
3801
|
+
* @returns The AST node for the UPDATE query
|
|
3802
|
+
*/
|
|
3414
3803
|
getAST(): UpdateQueryNode;
|
|
3415
3804
|
}
|
|
3416
3805
|
|
|
@@ -3420,12 +3809,42 @@ declare class UpdateQueryBuilder<T> {
|
|
|
3420
3809
|
declare class DeleteQueryState {
|
|
3421
3810
|
readonly table: TableDef;
|
|
3422
3811
|
readonly ast: DeleteQueryNode;
|
|
3812
|
+
/**
|
|
3813
|
+
* Creates a new DeleteQueryState instance
|
|
3814
|
+
* @param table - The table definition for the DELETE query
|
|
3815
|
+
* @param ast - Optional initial AST node, defaults to a basic DELETE query
|
|
3816
|
+
*/
|
|
3423
3817
|
constructor(table: TableDef, ast?: DeleteQueryNode);
|
|
3424
3818
|
private clone;
|
|
3819
|
+
/**
|
|
3820
|
+
* Adds a WHERE clause to the DELETE query
|
|
3821
|
+
* @param expr - The expression to use as the WHERE condition
|
|
3822
|
+
* @returns A new DeleteQueryState with the WHERE clause added
|
|
3823
|
+
*/
|
|
3425
3824
|
withWhere(expr: ExpressionNode): DeleteQueryState;
|
|
3825
|
+
/**
|
|
3826
|
+
* Adds a RETURNING clause to the DELETE query
|
|
3827
|
+
* @param columns - The columns to return after deletion
|
|
3828
|
+
* @returns A new DeleteQueryState with the RETURNING clause added
|
|
3829
|
+
*/
|
|
3426
3830
|
withReturning(columns: ColumnNode[]): DeleteQueryState;
|
|
3831
|
+
/**
|
|
3832
|
+
* Adds a USING clause to the DELETE query
|
|
3833
|
+
* @param source - The table source to use in the USING clause
|
|
3834
|
+
* @returns A new DeleteQueryState with the USING clause added
|
|
3835
|
+
*/
|
|
3427
3836
|
withUsing(source: TableSourceNode): DeleteQueryState;
|
|
3837
|
+
/**
|
|
3838
|
+
* Adds a JOIN clause to the DELETE query
|
|
3839
|
+
* @param join - The join node to add
|
|
3840
|
+
* @returns A new DeleteQueryState with the JOIN clause added
|
|
3841
|
+
*/
|
|
3428
3842
|
withJoin(join: JoinNode): DeleteQueryState;
|
|
3843
|
+
/**
|
|
3844
|
+
* Sets an alias for the table in the DELETE query
|
|
3845
|
+
* @param alias - The alias to assign to the table
|
|
3846
|
+
* @returns A new DeleteQueryState with the table alias set
|
|
3847
|
+
*/
|
|
3429
3848
|
withTableAlias(alias: string): DeleteQueryState;
|
|
3430
3849
|
}
|
|
3431
3850
|
|
|
@@ -3436,18 +3855,70 @@ type DeleteDialectInput = Dialect | DialectKey;
|
|
|
3436
3855
|
declare class DeleteQueryBuilder<T> {
|
|
3437
3856
|
private readonly table;
|
|
3438
3857
|
private readonly state;
|
|
3858
|
+
/**
|
|
3859
|
+
* Creates a new DeleteQueryBuilder instance
|
|
3860
|
+
* @param table - The table definition for the DELETE query
|
|
3861
|
+
* @param state - Optional initial query state, defaults to a new DeleteQueryState
|
|
3862
|
+
*/
|
|
3439
3863
|
constructor(table: TableDef, state?: DeleteQueryState);
|
|
3440
3864
|
private clone;
|
|
3865
|
+
/**
|
|
3866
|
+
* Adds a WHERE clause to the DELETE query
|
|
3867
|
+
* @param expr - The expression to use as the WHERE condition
|
|
3868
|
+
* @returns A new DeleteQueryBuilder with the WHERE clause added
|
|
3869
|
+
*/
|
|
3441
3870
|
where(expr: ExpressionNode): DeleteQueryBuilder<T>;
|
|
3871
|
+
/**
|
|
3872
|
+
* Sets an alias for the table in the DELETE query
|
|
3873
|
+
* @param alias - The alias to assign to the table
|
|
3874
|
+
* @returns A new DeleteQueryBuilder with the table alias set
|
|
3875
|
+
*/
|
|
3442
3876
|
as(alias: string): DeleteQueryBuilder<T>;
|
|
3877
|
+
/**
|
|
3878
|
+
* Adds a USING clause to the DELETE query
|
|
3879
|
+
* @param source - The table source to use in the USING clause
|
|
3880
|
+
* @returns A new DeleteQueryBuilder with the USING clause added
|
|
3881
|
+
*/
|
|
3443
3882
|
using(source: TableDef | TableSourceNode): DeleteQueryBuilder<T>;
|
|
3883
|
+
/**
|
|
3884
|
+
* Adds a JOIN clause to the DELETE query
|
|
3885
|
+
* @param table - The table to join with
|
|
3886
|
+
* @param condition - The join condition expression
|
|
3887
|
+
* @param kind - The type of join (defaults to INNER)
|
|
3888
|
+
* @param relationName - Optional name for the relation
|
|
3889
|
+
* @returns A new DeleteQueryBuilder with the JOIN clause added
|
|
3890
|
+
*/
|
|
3444
3891
|
join(table: TableDef | TableSourceNode | string, condition: ExpressionNode, kind?: JoinKind, relationName?: string): DeleteQueryBuilder<T>;
|
|
3892
|
+
/**
|
|
3893
|
+
* Adds a RETURNING clause to the DELETE query
|
|
3894
|
+
* @param columns - The columns to return after deletion
|
|
3895
|
+
* @returns A new DeleteQueryBuilder with the RETURNING clause added
|
|
3896
|
+
*/
|
|
3445
3897
|
returning(...columns: (ColumnDef | ColumnNode)[]): DeleteQueryBuilder<T>;
|
|
3446
3898
|
private resolveTableSource;
|
|
3447
3899
|
private resolveJoinTarget;
|
|
3448
|
-
|
|
3900
|
+
/**
|
|
3901
|
+
* Compiles the DELETE query for the specified dialect
|
|
3902
|
+
* @param dialect - The SQL dialect to compile for
|
|
3903
|
+
* @returns The compiled query with SQL and parameters
|
|
3904
|
+
*/
|
|
3449
3905
|
compile(dialect: DeleteDialectInput): CompiledQuery;
|
|
3450
|
-
|
|
3906
|
+
/**
|
|
3907
|
+
* Returns the SQL string for the DELETE query
|
|
3908
|
+
* @param dialect - The SQL dialect to generate SQL for
|
|
3909
|
+
* @returns The SQL string representation of the query
|
|
3910
|
+
*/
|
|
3911
|
+
toSql(dialect: DeleteDialectInput): string;
|
|
3912
|
+
/**
|
|
3913
|
+
* Executes the DELETE query using the provided session
|
|
3914
|
+
* @param session - The ORM session to execute the query with
|
|
3915
|
+
* @returns A promise that resolves to the query results
|
|
3916
|
+
*/
|
|
3917
|
+
execute(session: OrmSession): Promise<QueryResult[]>;
|
|
3918
|
+
/**
|
|
3919
|
+
* Returns the Abstract Syntax Tree (AST) representation of the query
|
|
3920
|
+
* @returns The AST node for the DELETE query
|
|
3921
|
+
*/
|
|
3451
3922
|
getAST(): DeleteQueryNode;
|
|
3452
3923
|
}
|
|
3453
3924
|
|
|
@@ -3644,12 +4115,14 @@ declare class PostgresDialect extends SqlDialectBase {
|
|
|
3644
4115
|
supportsReturning(): boolean;
|
|
3645
4116
|
}
|
|
3646
4117
|
|
|
4118
|
+
/** Represents the differences detected in a database column's properties. */
|
|
3647
4119
|
interface ColumnDiff {
|
|
3648
4120
|
typeChanged?: boolean;
|
|
3649
4121
|
nullabilityChanged?: boolean;
|
|
3650
4122
|
defaultChanged?: boolean;
|
|
3651
4123
|
autoIncrementChanged?: boolean;
|
|
3652
4124
|
}
|
|
4125
|
+
/** Represents a column in the database schema. */
|
|
3653
4126
|
interface DatabaseColumn {
|
|
3654
4127
|
name: string;
|
|
3655
4128
|
type: string;
|
|
@@ -3661,16 +4134,19 @@ interface DatabaseColumn {
|
|
|
3661
4134
|
references?: ForeignKeyReference;
|
|
3662
4135
|
check?: string;
|
|
3663
4136
|
}
|
|
4137
|
+
/** Represents an index in the database schema. */
|
|
3664
4138
|
interface DatabaseIndex {
|
|
3665
4139
|
name: string;
|
|
3666
4140
|
columns: IndexColumn[];
|
|
3667
4141
|
unique?: boolean;
|
|
3668
4142
|
where?: string;
|
|
3669
4143
|
}
|
|
4144
|
+
/** Represents a check constraint in the database schema. */
|
|
3670
4145
|
interface DatabaseCheck {
|
|
3671
4146
|
name?: string;
|
|
3672
4147
|
expression: string;
|
|
3673
4148
|
}
|
|
4149
|
+
/** Represents a table in the database schema. */
|
|
3674
4150
|
interface DatabaseTable {
|
|
3675
4151
|
name: string;
|
|
3676
4152
|
schema?: string;
|
|
@@ -3679,46 +4155,90 @@ interface DatabaseTable {
|
|
|
3679
4155
|
indexes?: DatabaseIndex[];
|
|
3680
4156
|
checks?: DatabaseCheck[];
|
|
3681
4157
|
}
|
|
4158
|
+
/** Represents the overall database schema. */
|
|
3682
4159
|
interface DatabaseSchema {
|
|
3683
4160
|
tables: DatabaseTable[];
|
|
3684
4161
|
}
|
|
3685
4162
|
|
|
4163
|
+
/** The name of a database dialect. */
|
|
3686
4164
|
type DialectName = 'postgres' | 'mysql' | 'sqlite' | 'mssql' | (string & {});
|
|
4165
|
+
/** Interface for schema dialect implementations that handle database-specific DDL operations. */
|
|
3687
4166
|
interface SchemaDialect {
|
|
4167
|
+
/** The name of the dialect. */
|
|
3688
4168
|
readonly name: DialectName;
|
|
4169
|
+
/** Quotes an identifier for use in SQL. */
|
|
3689
4170
|
quoteIdentifier(id: string): string;
|
|
4171
|
+
/** Formats the table name for SQL. */
|
|
3690
4172
|
formatTableName(table: TableDef | DatabaseTable): string;
|
|
4173
|
+
/** Renders the column type for SQL. */
|
|
3691
4174
|
renderColumnType(column: ColumnDef): string;
|
|
4175
|
+
/** Renders the default value for SQL. */
|
|
3692
4176
|
renderDefault(value: unknown, column: ColumnDef): string;
|
|
4177
|
+
/** Renders the auto-increment clause for SQL. */
|
|
3693
4178
|
renderAutoIncrement(column: ColumnDef, table: TableDef): string | undefined;
|
|
4179
|
+
/** Renders a foreign key reference for SQL. */
|
|
3694
4180
|
renderReference(ref: ForeignKeyReference, table: TableDef): string;
|
|
4181
|
+
/** Renders an index for SQL. */
|
|
3695
4182
|
renderIndex(table: TableDef, index: IndexDef): string;
|
|
4183
|
+
/** Renders table options for SQL. */
|
|
3696
4184
|
renderTableOptions(table: TableDef): string | undefined;
|
|
4185
|
+
/** Checks if the dialect supports partial indexes. */
|
|
3697
4186
|
supportsPartialIndexes(): boolean;
|
|
4187
|
+
/** Checks if the dialect prefers inline primary key auto-increment. */
|
|
3698
4188
|
preferInlinePkAutoincrement(column: ColumnDef, table: TableDef, pk: string[]): boolean;
|
|
4189
|
+
/** Generates SQL to drop a column. */
|
|
3699
4190
|
dropColumnSql?(table: DatabaseTable, column: string): string[];
|
|
4191
|
+
/** Generates SQL to drop an index. */
|
|
3700
4192
|
dropIndexSql?(table: DatabaseTable, index: string): string[];
|
|
4193
|
+
/** Generates SQL to drop a table. */
|
|
3701
4194
|
dropTableSql?(table: DatabaseTable): string[];
|
|
4195
|
+
/** Returns a warning message for dropping a column. */
|
|
3702
4196
|
warnDropColumn?(table: DatabaseTable, column: string): string | undefined;
|
|
4197
|
+
/** Generates SQL to alter a column. */
|
|
3703
4198
|
alterColumnSql?(table: TableDef, column: ColumnDef, actualColumn: DatabaseColumn, diff: ColumnDiff): string[];
|
|
4199
|
+
/** Returns a warning message for altering a column. */
|
|
3704
4200
|
warnAlterColumn?(table: TableDef, column: ColumnDef, actualColumn: DatabaseColumn, diff: ColumnDiff): string | undefined;
|
|
3705
4201
|
}
|
|
3706
4202
|
|
|
4203
|
+
/** Result of generating schema SQL. */
|
|
3707
4204
|
interface SchemaGenerateResult {
|
|
3708
4205
|
tableSql: string;
|
|
3709
4206
|
indexSql: string[];
|
|
3710
4207
|
}
|
|
4208
|
+
/** Options for rendering column definitions. */
|
|
3711
4209
|
interface RenderColumnOptions {
|
|
3712
4210
|
includePrimary?: boolean;
|
|
3713
4211
|
}
|
|
4212
|
+
/**
|
|
4213
|
+
* Renders a column definition for SQL.
|
|
4214
|
+
* @param table - The table definition.
|
|
4215
|
+
* @param col - The column definition.
|
|
4216
|
+
* @param dialect - The schema dialect.
|
|
4217
|
+
* @param options - Options for rendering.
|
|
4218
|
+
* @returns The rendered SQL and whether primary key is inline.
|
|
4219
|
+
*/
|
|
3714
4220
|
declare const renderColumnDefinition: (table: TableDef, col: ColumnDef, dialect: SchemaDialect, options?: RenderColumnOptions) => {
|
|
3715
4221
|
sql: string;
|
|
3716
4222
|
inlinePrimary: boolean;
|
|
3717
4223
|
};
|
|
4224
|
+
/**
|
|
4225
|
+
* Generates SQL to create a table.
|
|
4226
|
+
* @param table - The table definition.
|
|
4227
|
+
* @param dialect - The schema dialect.
|
|
4228
|
+
* @returns The table SQL and index SQL.
|
|
4229
|
+
*/
|
|
3718
4230
|
declare const generateCreateTableSql: (table: TableDef, dialect: SchemaDialect) => SchemaGenerateResult;
|
|
4231
|
+
/**
|
|
4232
|
+
* Generates SQL for creating multiple tables.
|
|
4233
|
+
* @param tables - The table definitions.
|
|
4234
|
+
* @param dialect - The schema dialect.
|
|
4235
|
+
* @returns The SQL statements.
|
|
4236
|
+
*/
|
|
3719
4237
|
declare const generateSchemaSql: (tables: TableDef[], dialect: SchemaDialect) => string[];
|
|
3720
4238
|
|
|
4239
|
+
/** The kind of schema change. */
|
|
3721
4240
|
type SchemaChangeKind = 'createTable' | 'dropTable' | 'addColumn' | 'dropColumn' | 'alterColumn' | 'addIndex' | 'dropIndex';
|
|
4241
|
+
/** Represents a single schema change. */
|
|
3722
4242
|
interface SchemaChange {
|
|
3723
4243
|
kind: SchemaChangeKind;
|
|
3724
4244
|
table: string;
|
|
@@ -3726,22 +4246,48 @@ interface SchemaChange {
|
|
|
3726
4246
|
statements: string[];
|
|
3727
4247
|
safe: boolean;
|
|
3728
4248
|
}
|
|
4249
|
+
/** Represents a plan of schema changes. */
|
|
3729
4250
|
interface SchemaPlan {
|
|
3730
4251
|
changes: SchemaChange[];
|
|
3731
4252
|
warnings: string[];
|
|
3732
4253
|
}
|
|
4254
|
+
/** Options for schema diffing. */
|
|
3733
4255
|
interface SchemaDiffOptions {
|
|
3734
4256
|
/** Allow destructive operations (drops) */
|
|
3735
4257
|
allowDestructive?: boolean;
|
|
3736
4258
|
}
|
|
4259
|
+
/**
|
|
4260
|
+
* Computes the differences between expected and actual database schemas.
|
|
4261
|
+
* @param expectedTables - The expected table definitions.
|
|
4262
|
+
* @param actualSchema - The actual database schema.
|
|
4263
|
+
* @param dialect - The schema dialect.
|
|
4264
|
+
* @param options - Options for the diff.
|
|
4265
|
+
* @returns The schema plan with changes and warnings.
|
|
4266
|
+
*/
|
|
3737
4267
|
declare const diffSchema: (expectedTables: TableDef[], actualSchema: DatabaseSchema, dialect: SchemaDialect, options?: SchemaDiffOptions) => SchemaPlan;
|
|
4268
|
+
/** Options for schema synchronization. */
|
|
3738
4269
|
interface SynchronizeOptions extends SchemaDiffOptions {
|
|
3739
4270
|
dryRun?: boolean;
|
|
3740
4271
|
}
|
|
4272
|
+
/**
|
|
4273
|
+
* Synchronizes the database schema with the expected tables.
|
|
4274
|
+
* @param expectedTables - The expected table definitions.
|
|
4275
|
+
* @param actualSchema - The actual database schema.
|
|
4276
|
+
* @param dialect - The schema dialect.
|
|
4277
|
+
* @param executor - The database executor.
|
|
4278
|
+
* @param options - Options for synchronization.
|
|
4279
|
+
* @returns The schema plan with changes and warnings.
|
|
4280
|
+
*/
|
|
3741
4281
|
declare const synchronizeSchema: (expectedTables: TableDef[], actualSchema: DatabaseSchema, dialect: SchemaDialect, executor: DbExecutor, options?: SynchronizeOptions) => Promise<SchemaPlan>;
|
|
3742
4282
|
|
|
4283
|
+
/**
|
|
4284
|
+
* Context for schema introspection operations.
|
|
4285
|
+
* Provides the necessary components to perform database schema introspection.
|
|
4286
|
+
*/
|
|
3743
4287
|
interface IntrospectContext {
|
|
4288
|
+
/** The database dialect used for introspection. */
|
|
3744
4289
|
dialect: Dialect;
|
|
4290
|
+
/** The database executor for running introspection queries. */
|
|
3745
4291
|
executor: DbExecutor;
|
|
3746
4292
|
}
|
|
3747
4293
|
|
|
@@ -3766,327 +4312,512 @@ interface SchemaIntrospector {
|
|
|
3766
4312
|
*/
|
|
3767
4313
|
declare const introspectSchema: (executor: DbExecutor, dialect: DialectName, options?: IntrospectOptions) => Promise<DatabaseSchema>;
|
|
3768
4314
|
|
|
4315
|
+
/**
|
|
4316
|
+
* Registers a schema introspector for a dialect.
|
|
4317
|
+
* @param dialect - The dialect name.
|
|
4318
|
+
* @param introspector - The schema introspector.
|
|
4319
|
+
*/
|
|
3769
4320
|
declare const registerSchemaIntrospector: (dialect: DialectName, introspector: SchemaIntrospector) => void;
|
|
4321
|
+
/**
|
|
4322
|
+
* Gets the schema introspector for a dialect.
|
|
4323
|
+
* @param dialect - The dialect name.
|
|
4324
|
+
* @returns The schema introspector or undefined if not found.
|
|
4325
|
+
*/
|
|
3770
4326
|
declare const getSchemaIntrospector: (dialect: DialectName) => SchemaIntrospector | undefined;
|
|
3771
4327
|
|
|
3772
4328
|
type OperandInput$2 = OperandNode | ColumnDef | string | number | boolean | null;
|
|
3773
4329
|
/**
|
|
3774
|
-
*
|
|
4330
|
+
* Converts a string to lowercase.
|
|
4331
|
+
* @param value - The string value.
|
|
4332
|
+
* @returns A FunctionNode representing the LOWER SQL function.
|
|
3775
4333
|
*/
|
|
3776
4334
|
declare const lower: (value: OperandInput$2) => FunctionNode;
|
|
3777
4335
|
/**
|
|
3778
|
-
*
|
|
4336
|
+
* Converts a string to uppercase.
|
|
4337
|
+
* @param value - The string value.
|
|
4338
|
+
* @returns A FunctionNode representing the UPPER SQL function.
|
|
3779
4339
|
*/
|
|
3780
4340
|
declare const upper: (value: OperandInput$2) => FunctionNode;
|
|
3781
4341
|
/**
|
|
3782
|
-
*
|
|
4342
|
+
* Returns the ASCII code of the first character of a string.
|
|
4343
|
+
* @param value - The string value.
|
|
4344
|
+
* @returns A FunctionNode representing the ASCII SQL function.
|
|
3783
4345
|
*/
|
|
3784
4346
|
declare const ascii: (value: OperandInput$2) => FunctionNode;
|
|
3785
4347
|
/**
|
|
3786
|
-
*
|
|
4348
|
+
* Returns a string from one or more ASCII codes.
|
|
4349
|
+
* @param codes - The ASCII codes.
|
|
4350
|
+
* @returns A FunctionNode representing the CHAR SQL function.
|
|
3787
4351
|
*/
|
|
3788
4352
|
declare const char: (...codes: OperandInput$2[]) => FunctionNode;
|
|
3789
4353
|
/**
|
|
3790
|
-
*
|
|
4354
|
+
* Returns the number of characters in a string.
|
|
4355
|
+
* @param value - The string value.
|
|
4356
|
+
* @returns A FunctionNode representing the CHAR_LENGTH SQL function.
|
|
3791
4357
|
*/
|
|
3792
4358
|
declare const charLength: (value: OperandInput$2) => FunctionNode;
|
|
3793
4359
|
/**
|
|
3794
|
-
*
|
|
4360
|
+
* Returns the length of a string in bytes or characters.
|
|
4361
|
+
* @param value - The string value.
|
|
4362
|
+
* @returns A FunctionNode representing the LENGTH SQL function.
|
|
3795
4363
|
*/
|
|
3796
4364
|
declare const length: (value: OperandInput$2) => FunctionNode;
|
|
3797
4365
|
/**
|
|
3798
|
-
*
|
|
4366
|
+
* Removes leading and trailing whitespace or specified characters from a string.
|
|
4367
|
+
* @param value - The string value.
|
|
4368
|
+
* @param chars - The characters to trim (optional).
|
|
4369
|
+
* @returns A FunctionNode representing the TRIM SQL function.
|
|
3799
4370
|
*/
|
|
3800
4371
|
declare const trim: (value: OperandInput$2, chars?: OperandInput$2) => FunctionNode;
|
|
3801
4372
|
/**
|
|
3802
|
-
*
|
|
4373
|
+
* Removes leading whitespace from a string.
|
|
4374
|
+
* @param value - The string value.
|
|
4375
|
+
* @returns A FunctionNode representing the LTRIM SQL function.
|
|
3803
4376
|
*/
|
|
3804
4377
|
declare const ltrim: (value: OperandInput$2) => FunctionNode;
|
|
3805
4378
|
/**
|
|
3806
|
-
*
|
|
4379
|
+
* Removes trailing whitespace from a string.
|
|
4380
|
+
* @param value - The string value.
|
|
4381
|
+
* @returns A FunctionNode representing the RTRIM SQL function.
|
|
3807
4382
|
*/
|
|
3808
4383
|
declare const rtrim: (value: OperandInput$2) => FunctionNode;
|
|
3809
4384
|
/**
|
|
3810
|
-
*
|
|
4385
|
+
* Concatenates two or more strings.
|
|
4386
|
+
* @param args - The strings to concatenate.
|
|
4387
|
+
* @returns A FunctionNode representing the CONCAT SQL function.
|
|
3811
4388
|
*/
|
|
3812
4389
|
declare const concat: (...args: OperandInput$2[]) => FunctionNode;
|
|
3813
4390
|
/**
|
|
3814
|
-
*
|
|
4391
|
+
* Concatenates strings with a separator.
|
|
4392
|
+
* @param separator - The separator string.
|
|
4393
|
+
* @param args - The strings to concatenate.
|
|
4394
|
+
* @returns A FunctionNode representing the CONCAT_WS SQL function.
|
|
3815
4395
|
*/
|
|
3816
4396
|
declare const concatWs: (separator: OperandInput$2, ...args: OperandInput$2[]) => FunctionNode;
|
|
3817
4397
|
/**
|
|
3818
|
-
*
|
|
4398
|
+
* Extracts a substring from a string.
|
|
4399
|
+
* @param value - The string value.
|
|
4400
|
+
* @param start - The starting position.
|
|
4401
|
+
* @param length - The length of the substring (optional).
|
|
4402
|
+
* @returns A FunctionNode representing the SUBSTR SQL function.
|
|
3819
4403
|
*/
|
|
3820
4404
|
declare const substr: (value: OperandInput$2, start: OperandInput$2, length?: OperandInput$2) => FunctionNode;
|
|
3821
4405
|
/**
|
|
3822
|
-
*
|
|
4406
|
+
* Returns the leftmost characters of a string.
|
|
4407
|
+
* @param value - The string value.
|
|
4408
|
+
* @param len - The number of characters to return.
|
|
4409
|
+
* @returns A FunctionNode representing the LEFT SQL function.
|
|
3823
4410
|
*/
|
|
3824
4411
|
declare const left: (value: OperandInput$2, len: OperandInput$2) => FunctionNode;
|
|
3825
4412
|
/**
|
|
3826
|
-
*
|
|
4413
|
+
* Returns the rightmost characters of a string.
|
|
4414
|
+
* @param value - The string value.
|
|
4415
|
+
* @param len - The number of characters to return.
|
|
4416
|
+
* @returns A FunctionNode representing the RIGHT SQL function.
|
|
3827
4417
|
*/
|
|
3828
4418
|
declare const right: (value: OperandInput$2, len: OperandInput$2) => FunctionNode;
|
|
3829
4419
|
/**
|
|
3830
|
-
*
|
|
4420
|
+
* Returns the position of a substring in a string.
|
|
4421
|
+
* @param substring - The substring to search for.
|
|
4422
|
+
* @param value - The string to search in.
|
|
4423
|
+
* @returns A FunctionNode representing the POSITION SQL function.
|
|
3831
4424
|
*/
|
|
3832
4425
|
declare const position: (substring: OperandInput$2, value: OperandInput$2) => FunctionNode;
|
|
3833
4426
|
/**
|
|
3834
|
-
*
|
|
4427
|
+
* Returns the position of a substring in a string.
|
|
4428
|
+
* @param value - The string to search in.
|
|
4429
|
+
* @param substring - The substring to search for.
|
|
4430
|
+
* @returns A FunctionNode representing the INSTR SQL function.
|
|
3835
4431
|
*/
|
|
3836
4432
|
declare const instr: (value: OperandInput$2, substring: OperandInput$2) => FunctionNode;
|
|
3837
4433
|
/**
|
|
3838
|
-
*
|
|
4434
|
+
* Returns the position of a substring in a string, optionally starting from a position.
|
|
4435
|
+
* @param substring - The substring to search for.
|
|
4436
|
+
* @param value - The string to search in.
|
|
4437
|
+
* @param start - The starting position (optional).
|
|
4438
|
+
* @returns A FunctionNode representing the LOCATE SQL function.
|
|
3839
4439
|
*/
|
|
3840
4440
|
declare const locate: (substring: OperandInput$2, value: OperandInput$2, start?: OperandInput$2) => FunctionNode;
|
|
3841
4441
|
/**
|
|
3842
|
-
*
|
|
4442
|
+
* Replaces occurrences of a substring in a string.
|
|
4443
|
+
* @param value - The string to search in.
|
|
4444
|
+
* @param search - The substring to replace.
|
|
4445
|
+
* @param replacement - The replacement string.
|
|
4446
|
+
* @returns A FunctionNode representing the REPLACE SQL function.
|
|
3843
4447
|
*/
|
|
3844
4448
|
declare const replace: (value: OperandInput$2, search: OperandInput$2, replacement: OperandInput$2) => FunctionNode;
|
|
3845
4449
|
/**
|
|
3846
|
-
*
|
|
4450
|
+
* Repeats a string a specified number of times.
|
|
4451
|
+
* @param value - The string to repeat.
|
|
4452
|
+
* @param count - The number of times to repeat.
|
|
4453
|
+
* @returns A FunctionNode representing the REPEAT SQL function.
|
|
3847
4454
|
*/
|
|
3848
4455
|
declare const repeat: (value: OperandInput$2, count: OperandInput$2) => FunctionNode;
|
|
3849
4456
|
/**
|
|
3850
|
-
*
|
|
4457
|
+
* Left-pads a string to a certain length with another string.
|
|
4458
|
+
* @param value - The string to pad.
|
|
4459
|
+
* @param len - The length to pad to.
|
|
4460
|
+
* @param pad - The padding string.
|
|
4461
|
+
* @returns A FunctionNode representing the LPAD SQL function.
|
|
3851
4462
|
*/
|
|
3852
4463
|
declare const lpad: (value: OperandInput$2, len: OperandInput$2, pad: OperandInput$2) => FunctionNode;
|
|
3853
4464
|
/**
|
|
3854
|
-
*
|
|
4465
|
+
* Right-pads a string to a certain length with another string.
|
|
4466
|
+
* @param value - The string to pad.
|
|
4467
|
+
* @param len - The length to pad to.
|
|
4468
|
+
* @param pad - The padding string.
|
|
4469
|
+
* @returns A FunctionNode representing the RPAD SQL function.
|
|
3855
4470
|
*/
|
|
3856
4471
|
declare const rpad: (value: OperandInput$2, len: OperandInput$2, pad: OperandInput$2) => FunctionNode;
|
|
3857
4472
|
/**
|
|
3858
|
-
*
|
|
4473
|
+
* Returns a string consisting of a specified number of spaces.
|
|
4474
|
+
* @param count - The number of spaces.
|
|
4475
|
+
* @returns A FunctionNode representing the SPACE SQL function.
|
|
3859
4476
|
*/
|
|
3860
4477
|
declare const space: (count: OperandInput$2) => FunctionNode;
|
|
3861
4478
|
|
|
3862
4479
|
type OperandInput$1 = OperandNode | ColumnDef | string | number | boolean | null;
|
|
3863
4480
|
/**
|
|
3864
|
-
*
|
|
4481
|
+
* Returns the absolute value of a number.
|
|
4482
|
+
* @param value - The numeric value.
|
|
4483
|
+
* @returns A FunctionNode representing the ABS SQL function.
|
|
3865
4484
|
*/
|
|
3866
4485
|
declare const abs: (value: OperandInput$1) => FunctionNode;
|
|
3867
4486
|
/**
|
|
3868
|
-
*
|
|
4487
|
+
* Returns the arccosine (inverse cosine) of a number.
|
|
4488
|
+
* @param value - The numeric value.
|
|
4489
|
+
* @returns A FunctionNode representing the ACOS SQL function.
|
|
3869
4490
|
*/
|
|
3870
4491
|
declare const acos: (value: OperandInput$1) => FunctionNode;
|
|
3871
4492
|
/**
|
|
3872
|
-
*
|
|
4493
|
+
* Returns the arcsine (inverse sine) of a number.
|
|
4494
|
+
* @param value - The numeric value.
|
|
4495
|
+
* @returns A FunctionNode representing the ASIN SQL function.
|
|
3873
4496
|
*/
|
|
3874
4497
|
declare const asin: (value: OperandInput$1) => FunctionNode;
|
|
3875
4498
|
/**
|
|
3876
|
-
*
|
|
4499
|
+
* Returns the arctangent (inverse tangent) of a number.
|
|
4500
|
+
* @param value - The numeric value.
|
|
4501
|
+
* @returns A FunctionNode representing the ATAN SQL function.
|
|
3877
4502
|
*/
|
|
3878
4503
|
declare const atan: (value: OperandInput$1) => FunctionNode;
|
|
3879
4504
|
/**
|
|
3880
|
-
*
|
|
4505
|
+
* Returns the arctangent of the two arguments.
|
|
4506
|
+
* @param y - The y-coordinate.
|
|
4507
|
+
* @param x - The x-coordinate.
|
|
4508
|
+
* @returns A FunctionNode representing the ATAN2 SQL function.
|
|
3881
4509
|
*/
|
|
3882
4510
|
declare const atan2: (y: OperandInput$1, x: OperandInput$1) => FunctionNode;
|
|
3883
4511
|
/**
|
|
3884
|
-
*
|
|
4512
|
+
* Returns the smallest integer greater than or equal to a number.
|
|
4513
|
+
* @param value - The numeric value.
|
|
4514
|
+
* @returns A FunctionNode representing the CEIL SQL function.
|
|
3885
4515
|
*/
|
|
3886
4516
|
declare const ceil: (value: OperandInput$1) => FunctionNode;
|
|
3887
4517
|
/**
|
|
3888
|
-
*
|
|
4518
|
+
* Alias for ceil. Returns the smallest integer greater than or equal to a number.
|
|
4519
|
+
* @param value - The numeric value.
|
|
4520
|
+
* @returns A FunctionNode representing the CEILING SQL function.
|
|
3889
4521
|
*/
|
|
3890
4522
|
declare const ceiling: (value: OperandInput$1) => FunctionNode;
|
|
3891
4523
|
/**
|
|
3892
|
-
*
|
|
4524
|
+
* Returns the cosine of a number (in radians).
|
|
4525
|
+
* @param value - The numeric value in radians.
|
|
4526
|
+
* @returns A FunctionNode representing the COS SQL function.
|
|
3893
4527
|
*/
|
|
3894
4528
|
declare const cos: (value: OperandInput$1) => FunctionNode;
|
|
3895
4529
|
/**
|
|
3896
|
-
*
|
|
4530
|
+
* Returns the cotangent of a number.
|
|
4531
|
+
* @param value - The numeric value.
|
|
4532
|
+
* @returns A FunctionNode representing the COT SQL function.
|
|
3897
4533
|
*/
|
|
3898
4534
|
declare const cot: (value: OperandInput$1) => FunctionNode;
|
|
3899
4535
|
/**
|
|
3900
|
-
*
|
|
4536
|
+
* Converts radians to degrees.
|
|
4537
|
+
* @param value - The angle in radians.
|
|
4538
|
+
* @returns A FunctionNode representing the DEGREES SQL function.
|
|
3901
4539
|
*/
|
|
3902
4540
|
declare const degrees: (value: OperandInput$1) => FunctionNode;
|
|
3903
4541
|
/**
|
|
3904
|
-
*
|
|
4542
|
+
* Returns e raised to the power of the argument.
|
|
4543
|
+
* @param value - The exponent.
|
|
4544
|
+
* @returns A FunctionNode representing the EXP SQL function.
|
|
3905
4545
|
*/
|
|
3906
4546
|
declare const exp: (value: OperandInput$1) => FunctionNode;
|
|
3907
4547
|
/**
|
|
3908
|
-
*
|
|
4548
|
+
* Returns the largest integer less than or equal to a number.
|
|
4549
|
+
* @param value - The numeric value.
|
|
4550
|
+
* @returns A FunctionNode representing the FLOOR SQL function.
|
|
3909
4551
|
*/
|
|
3910
4552
|
declare const floor: (value: OperandInput$1) => FunctionNode;
|
|
3911
4553
|
/**
|
|
3912
|
-
*
|
|
4554
|
+
* Returns the natural logarithm (base e) of a number.
|
|
4555
|
+
* @param value - The numeric value.
|
|
4556
|
+
* @returns A FunctionNode representing the LN SQL function.
|
|
3913
4557
|
*/
|
|
3914
4558
|
declare const ln: (value: OperandInput$1) => FunctionNode;
|
|
3915
4559
|
/**
|
|
3916
|
-
*
|
|
4560
|
+
* Returns the base-10 logarithm of a number.
|
|
4561
|
+
* @param value - The numeric value.
|
|
4562
|
+
* @returns A FunctionNode representing the LOG SQL function.
|
|
3917
4563
|
*/
|
|
3918
4564
|
declare const log: (value: OperandInput$1) => FunctionNode;
|
|
3919
4565
|
/**
|
|
3920
|
-
*
|
|
4566
|
+
* Returns the base-10 logarithm of a number.
|
|
4567
|
+
* @param value - The numeric value.
|
|
4568
|
+
* @returns A FunctionNode representing the LOG10 SQL function.
|
|
3921
4569
|
*/
|
|
3922
4570
|
declare const log10: (value: OperandInput$1) => FunctionNode;
|
|
3923
4571
|
/**
|
|
3924
|
-
*
|
|
4572
|
+
* Returns the logarithm of a number for a specific base.
|
|
4573
|
+
* @param base - The base of the logarithm.
|
|
4574
|
+
* @param value - The numeric value.
|
|
4575
|
+
* @returns A FunctionNode representing the LOG_BASE SQL function.
|
|
3925
4576
|
*/
|
|
3926
4577
|
declare const logBase: (base: OperandInput$1, value: OperandInput$1) => FunctionNode;
|
|
3927
4578
|
/**
|
|
3928
|
-
*
|
|
4579
|
+
* Returns the remainder of dividing x by y.
|
|
4580
|
+
* @param x - The dividend.
|
|
4581
|
+
* @param y - The divisor.
|
|
4582
|
+
* @returns A FunctionNode representing the MOD SQL function.
|
|
3929
4583
|
*/
|
|
3930
4584
|
declare const mod: (x: OperandInput$1, y: OperandInput$1) => FunctionNode;
|
|
3931
4585
|
/**
|
|
3932
|
-
*
|
|
4586
|
+
* Returns the value of PI (approximately 3.14159...).
|
|
4587
|
+
* @returns A FunctionNode representing the PI SQL function.
|
|
3933
4588
|
*/
|
|
3934
4589
|
declare const pi: () => FunctionNode;
|
|
3935
4590
|
/**
|
|
3936
|
-
*
|
|
4591
|
+
* Returns x raised to the power of y.
|
|
4592
|
+
* @param x - The base.
|
|
4593
|
+
* @param y - The exponent.
|
|
4594
|
+
* @returns A FunctionNode representing the POWER SQL function.
|
|
3937
4595
|
*/
|
|
3938
4596
|
declare const power: (x: OperandInput$1, y: OperandInput$1) => FunctionNode;
|
|
3939
4597
|
/**
|
|
3940
|
-
*
|
|
4598
|
+
* Alias for power. Returns x raised to the power of y.
|
|
4599
|
+
* @param x - The base.
|
|
4600
|
+
* @param y - The exponent.
|
|
4601
|
+
* @returns A FunctionNode representing the POW SQL function.
|
|
3941
4602
|
*/
|
|
3942
4603
|
declare const pow: (x: OperandInput$1, y: OperandInput$1) => FunctionNode;
|
|
3943
4604
|
/**
|
|
3944
|
-
*
|
|
4605
|
+
* Converts degrees to radians.
|
|
4606
|
+
* @param value - The angle in degrees.
|
|
4607
|
+
* @returns A FunctionNode representing the RADIANS SQL function.
|
|
3945
4608
|
*/
|
|
3946
4609
|
declare const radians: (value: OperandInput$1) => FunctionNode;
|
|
3947
4610
|
/**
|
|
3948
|
-
*
|
|
4611
|
+
* Returns a random number between 0 and 1.
|
|
4612
|
+
* @returns A FunctionNode representing the RANDOM SQL function.
|
|
3949
4613
|
*/
|
|
3950
4614
|
declare const random: () => FunctionNode;
|
|
3951
4615
|
/**
|
|
3952
|
-
*
|
|
4616
|
+
* Alias for random. Returns a random number between 0 and 1.
|
|
4617
|
+
* @returns A FunctionNode representing the RAND SQL function.
|
|
3953
4618
|
*/
|
|
3954
4619
|
declare const rand: () => FunctionNode;
|
|
3955
4620
|
/**
|
|
3956
|
-
*
|
|
4621
|
+
* Rounds a number to a specified number of decimal places.
|
|
4622
|
+
* @param value - The numeric value to round.
|
|
4623
|
+
* @param decimals - The number of decimal places (optional).
|
|
4624
|
+
* @returns A FunctionNode representing the ROUND SQL function.
|
|
3957
4625
|
*/
|
|
3958
4626
|
declare const round: (value: OperandInput$1, decimals?: OperandInput$1) => FunctionNode;
|
|
3959
4627
|
/**
|
|
3960
|
-
*
|
|
4628
|
+
* Returns the sign of a number (-1 for negative, 0 for zero, 1 for positive).
|
|
4629
|
+
* @param value - The numeric value.
|
|
4630
|
+
* @returns A FunctionNode representing the SIGN SQL function.
|
|
3961
4631
|
*/
|
|
3962
4632
|
declare const sign: (value: OperandInput$1) => FunctionNode;
|
|
3963
4633
|
/**
|
|
3964
|
-
*
|
|
4634
|
+
* Returns the sine of a number (in radians).
|
|
4635
|
+
* @param value - The numeric value in radians.
|
|
4636
|
+
* @returns A FunctionNode representing the SIN SQL function.
|
|
3965
4637
|
*/
|
|
3966
4638
|
declare const sin: (value: OperandInput$1) => FunctionNode;
|
|
3967
4639
|
/**
|
|
3968
|
-
*
|
|
4640
|
+
* Returns the square root of a number.
|
|
4641
|
+
* @param value - The numeric value.
|
|
4642
|
+
* @returns A FunctionNode representing the SQRT SQL function.
|
|
3969
4643
|
*/
|
|
3970
4644
|
declare const sqrt: (value: OperandInput$1) => FunctionNode;
|
|
3971
4645
|
/**
|
|
3972
|
-
*
|
|
4646
|
+
* Returns the tangent of a number (in radians).
|
|
4647
|
+
* @param value - The numeric value in radians.
|
|
4648
|
+
* @returns A FunctionNode representing the TAN SQL function.
|
|
3973
4649
|
*/
|
|
3974
4650
|
declare const tan: (value: OperandInput$1) => FunctionNode;
|
|
3975
4651
|
/**
|
|
3976
|
-
*
|
|
4652
|
+
* Truncates a number to a specified number of decimal places without rounding.
|
|
4653
|
+
* @param value - The numeric value to truncate.
|
|
4654
|
+
* @param decimals - The number of decimal places (optional).
|
|
4655
|
+
* @returns A FunctionNode representing the TRUNC SQL function.
|
|
3977
4656
|
*/
|
|
3978
4657
|
declare const trunc: (value: OperandInput$1, decimals?: OperandInput$1) => FunctionNode;
|
|
3979
4658
|
/**
|
|
3980
|
-
*
|
|
4659
|
+
* Alias for trunc. Truncates a number to a specified number of decimal places without rounding.
|
|
4660
|
+
* @param value - The numeric value to truncate.
|
|
4661
|
+
* @param decimals - The number of decimal places.
|
|
4662
|
+
* @returns A FunctionNode representing the TRUNCATE SQL function.
|
|
3981
4663
|
*/
|
|
3982
4664
|
declare const truncate: (value: OperandInput$1, decimals: OperandInput$1) => FunctionNode;
|
|
3983
4665
|
|
|
3984
4666
|
type OperandInput = OperandNode | ColumnDef | string | number | boolean | null;
|
|
3985
4667
|
/**
|
|
3986
|
-
*
|
|
4668
|
+
* Returns the current local date and time.
|
|
4669
|
+
* @returns A FunctionNode representing the NOW() SQL function.
|
|
3987
4670
|
*/
|
|
3988
4671
|
declare const now: () => FunctionNode;
|
|
3989
4672
|
/**
|
|
3990
|
-
*
|
|
4673
|
+
* Returns the current date without time.
|
|
4674
|
+
* @returns A FunctionNode representing the CURRENT_DATE SQL function.
|
|
3991
4675
|
*/
|
|
3992
4676
|
declare const currentDate: () => FunctionNode;
|
|
3993
4677
|
/**
|
|
3994
|
-
*
|
|
4678
|
+
* Returns the current time without date.
|
|
4679
|
+
* @returns A FunctionNode representing the CURRENT_TIME SQL function.
|
|
3995
4680
|
*/
|
|
3996
4681
|
declare const currentTime: () => FunctionNode;
|
|
3997
4682
|
/**
|
|
3998
|
-
*
|
|
4683
|
+
* Returns the current UTC date and time.
|
|
4684
|
+
* @returns A FunctionNode representing the UTC_NOW() SQL function.
|
|
3999
4685
|
*/
|
|
4000
4686
|
declare const utcNow: () => FunctionNode;
|
|
4001
4687
|
/**
|
|
4002
|
-
*
|
|
4003
|
-
* @param part - The date part to extract (e.g., 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', 'SECOND')
|
|
4004
|
-
* @param date - The date
|
|
4688
|
+
* Extracts a specified part from a date or datetime value.
|
|
4689
|
+
* @param part - The date part to extract (e.g., 'YEAR', 'MONTH', 'DAY', 'HOUR', 'MINUTE', 'SECOND').
|
|
4690
|
+
* @param date - The date or datetime value to extract from.
|
|
4691
|
+
* @returns A FunctionNode representing the EXTRACT SQL function.
|
|
4005
4692
|
*/
|
|
4006
4693
|
declare const extract: (part: OperandInput, date: OperandInput) => FunctionNode;
|
|
4007
4694
|
/**
|
|
4008
|
-
*
|
|
4695
|
+
* Extracts the year from a date or datetime value.
|
|
4696
|
+
* @param date - The date or datetime value.
|
|
4697
|
+
* @returns A FunctionNode representing the YEAR SQL function.
|
|
4009
4698
|
*/
|
|
4010
4699
|
declare const year: (date: OperandInput) => FunctionNode;
|
|
4011
4700
|
/**
|
|
4012
|
-
*
|
|
4701
|
+
* Extracts the month from a date or datetime value.
|
|
4702
|
+
* @param date - The date or datetime value.
|
|
4703
|
+
* @returns A FunctionNode representing the MONTH SQL function.
|
|
4013
4704
|
*/
|
|
4014
4705
|
declare const month: (date: OperandInput) => FunctionNode;
|
|
4015
4706
|
/**
|
|
4016
|
-
*
|
|
4707
|
+
* Extracts the day of the month from a date or datetime value.
|
|
4708
|
+
* @param date - The date or datetime value.
|
|
4709
|
+
* @returns A FunctionNode representing the DAY SQL function.
|
|
4017
4710
|
*/
|
|
4018
4711
|
declare const day: (date: OperandInput) => FunctionNode;
|
|
4019
4712
|
/**
|
|
4020
|
-
*
|
|
4021
|
-
* @param date - The date
|
|
4022
|
-
* @param interval - The number of units to add
|
|
4023
|
-
* @param unit - The unit type (e.g., 'DAY', 'MONTH', 'YEAR', 'HOUR', 'MINUTE', 'SECOND')
|
|
4713
|
+
* Adds a specified time interval to a date or datetime value.
|
|
4714
|
+
* @param date - The date or datetime value to add to.
|
|
4715
|
+
* @param interval - The number of units to add.
|
|
4716
|
+
* @param unit - The unit type (e.g., 'DAY', 'MONTH', 'YEAR', 'HOUR', 'MINUTE', 'SECOND').
|
|
4717
|
+
* @returns A FunctionNode representing the DATE_ADD SQL function.
|
|
4024
4718
|
*/
|
|
4025
4719
|
declare const dateAdd: (date: OperandInput, interval: OperandInput, unit: OperandInput) => FunctionNode;
|
|
4026
4720
|
/**
|
|
4027
|
-
*
|
|
4028
|
-
* @param date - The date
|
|
4029
|
-
* @param interval - The number of units to subtract
|
|
4030
|
-
* @param unit - The unit type (e.g., 'DAY', 'MONTH', 'YEAR', 'HOUR', 'MINUTE', 'SECOND')
|
|
4721
|
+
* Subtracts a specified time interval from a date or datetime value.
|
|
4722
|
+
* @param date - The date or datetime value to subtract from.
|
|
4723
|
+
* @param interval - The number of units to subtract.
|
|
4724
|
+
* @param unit - The unit type (e.g., 'DAY', 'MONTH', 'YEAR', 'HOUR', 'MINUTE', 'SECOND').
|
|
4725
|
+
* @returns A FunctionNode representing the DATE_SUB SQL function.
|
|
4031
4726
|
*/
|
|
4032
4727
|
declare const dateSub: (date: OperandInput, interval: OperandInput, unit: OperandInput) => FunctionNode;
|
|
4033
4728
|
/**
|
|
4034
|
-
*
|
|
4035
|
-
* @param date1 - The end date
|
|
4036
|
-
* @param date2 - The start date
|
|
4729
|
+
* Returns the difference between two dates in days.
|
|
4730
|
+
* @param date1 - The end date.
|
|
4731
|
+
* @param date2 - The start date.
|
|
4732
|
+
* @returns A FunctionNode representing the DATE_DIFF SQL function.
|
|
4037
4733
|
*/
|
|
4038
4734
|
declare const dateDiff: (date1: OperandInput, date2: OperandInput) => FunctionNode;
|
|
4039
4735
|
/**
|
|
4040
|
-
*
|
|
4041
|
-
* @param date - The date
|
|
4042
|
-
* @param format - The format string (dialect-specific)
|
|
4736
|
+
* Converts a date or datetime value to a formatted string.
|
|
4737
|
+
* @param date - The date or datetime value to format.
|
|
4738
|
+
* @param format - The format string (dialect-specific).
|
|
4739
|
+
* @returns A FunctionNode representing the DATE_FORMAT SQL function.
|
|
4043
4740
|
*/
|
|
4044
4741
|
declare const dateFormat: (date: OperandInput, format: OperandInput) => FunctionNode;
|
|
4045
4742
|
/**
|
|
4046
|
-
*
|
|
4743
|
+
* Returns the current Unix timestamp (seconds since 1970-01-01 00:00:00 UTC).
|
|
4744
|
+
* @returns A FunctionNode representing the UNIX_TIMESTAMP SQL function.
|
|
4047
4745
|
*/
|
|
4048
4746
|
declare const unixTimestamp: () => FunctionNode;
|
|
4049
4747
|
/**
|
|
4050
|
-
*
|
|
4051
|
-
* @param timestamp - Unix timestamp in seconds
|
|
4748
|
+
* Converts a Unix timestamp (seconds since 1970-01-01 00:00:00 UTC) to a date.
|
|
4749
|
+
* @param timestamp - Unix timestamp in seconds.
|
|
4750
|
+
* @returns A FunctionNode representing the FROM_UNIXTIME SQL function.
|
|
4052
4751
|
*/
|
|
4053
4752
|
declare const fromUnixTime: (timestamp: OperandInput) => FunctionNode;
|
|
4054
4753
|
/**
|
|
4055
|
-
*
|
|
4754
|
+
* Returns the last day of the month for a given date.
|
|
4755
|
+
* @param date - The date value.
|
|
4756
|
+
* @returns A FunctionNode representing the END_OF_MONTH SQL function.
|
|
4056
4757
|
*/
|
|
4057
4758
|
declare const endOfMonth: (date: OperandInput) => FunctionNode;
|
|
4058
4759
|
/**
|
|
4059
|
-
*
|
|
4760
|
+
* Returns the index of the weekday for a given date (1 = Sunday, 2 = Monday, etc.).
|
|
4761
|
+
* @param date - The date value.
|
|
4762
|
+
* @returns A FunctionNode representing the DAY_OF_WEEK SQL function.
|
|
4060
4763
|
*/
|
|
4061
4764
|
declare const dayOfWeek: (date: OperandInput) => FunctionNode;
|
|
4062
4765
|
/**
|
|
4063
|
-
*
|
|
4766
|
+
* Returns the week number of the year for a given date.
|
|
4767
|
+
* @param date - The date value.
|
|
4768
|
+
* @returns A FunctionNode representing the WEEK_OF_YEAR SQL function.
|
|
4064
4769
|
*/
|
|
4065
4770
|
declare const weekOfYear: (date: OperandInput) => FunctionNode;
|
|
4066
4771
|
/**
|
|
4067
|
-
*
|
|
4068
|
-
* @param part - The truncation precision (e.g., 'YEAR', 'MONTH', 'DAY')
|
|
4069
|
-
* @param date - The date
|
|
4772
|
+
* Truncates a date or datetime value to a specified precision (e.g., first day of the month/year).
|
|
4773
|
+
* @param part - The truncation precision (e.g., 'YEAR', 'MONTH', 'DAY').
|
|
4774
|
+
* @param date - The date or datetime value to truncate.
|
|
4775
|
+
* @returns A FunctionNode representing the DATE_TRUNC SQL function.
|
|
4070
4776
|
*/
|
|
4071
4777
|
declare const dateTrunc: (part: OperandInput, date: OperandInput) => FunctionNode;
|
|
4072
4778
|
|
|
4073
4779
|
/**
|
|
4074
|
-
* Browser-compatible implementation of AsyncLocalStorage
|
|
4075
|
-
* Provides a simple in-memory store for browser environments
|
|
4076
|
-
*
|
|
4780
|
+
* Browser-compatible implementation of AsyncLocalStorage.
|
|
4781
|
+
* Provides a simple in-memory store for browser environments while maintaining
|
|
4782
|
+
* Node.js AsyncLocalStorage API compatibility.
|
|
4783
|
+
*
|
|
4784
|
+
* @template T Type of the data stored in the async context
|
|
4077
4785
|
*/
|
|
4078
4786
|
declare class AsyncLocalStorage<T> {
|
|
4079
4787
|
private store;
|
|
4080
4788
|
/**
|
|
4081
|
-
* Executes a callback
|
|
4082
|
-
*
|
|
4083
|
-
*
|
|
4084
|
-
*
|
|
4789
|
+
* Executes a callback function within a context containing the specified store value.
|
|
4790
|
+
* The store value is only available during the callback's execution and is automatically
|
|
4791
|
+
* cleared afterward.
|
|
4792
|
+
*
|
|
4793
|
+
* @param store - The context value to make available during callback execution
|
|
4794
|
+
* @param callback - Function to execute with the store value available
|
|
4795
|
+
* @returns Result of the callback function execution
|
|
4796
|
+
*
|
|
4797
|
+
* @example
|
|
4798
|
+
* ```
|
|
4799
|
+
* const als = new AsyncLocalStorage<number>();
|
|
4800
|
+
* als.run(42, () => {
|
|
4801
|
+
* console.log(als.getStore()); // Outputs: 42
|
|
4802
|
+
* });
|
|
4803
|
+
* ```
|
|
4085
4804
|
*/
|
|
4086
4805
|
run<R>(store: T, callback: () => R): R;
|
|
4087
4806
|
/**
|
|
4088
|
-
*
|
|
4089
|
-
*
|
|
4807
|
+
* Retrieves the current store value from the async context.
|
|
4808
|
+
* Returns undefined if called outside of a `run()` callback execution.
|
|
4809
|
+
*
|
|
4810
|
+
* @returns Current store value or undefined if no context exists
|
|
4811
|
+
*
|
|
4812
|
+
* @example
|
|
4813
|
+
* ```
|
|
4814
|
+
* const als = new AsyncLocalStorage<string>();
|
|
4815
|
+
* console.log(als.getStore()); // Outputs: undefined
|
|
4816
|
+
*
|
|
4817
|
+
* als.run('hello', () => {
|
|
4818
|
+
* console.log(als.getStore()); // Outputs: 'hello'
|
|
4819
|
+
* });
|
|
4820
|
+
* ```
|
|
4090
4821
|
*/
|
|
4091
4822
|
getStore(): T | undefined;
|
|
4092
4823
|
}
|
|
@@ -4293,6 +5024,10 @@ interface EntityMeta<TTable extends TableDef> {
|
|
|
4293
5024
|
}
|
|
4294
5025
|
|
|
4295
5026
|
type Rows$2 = Record<string, unknown>[];
|
|
5027
|
+
/**
|
|
5028
|
+
* Default implementation of HasManyCollection for managing one-to-many relationships.
|
|
5029
|
+
* @template TChild - The type of child entities in the collection
|
|
5030
|
+
*/
|
|
4296
5031
|
declare class DefaultHasManyCollection<TChild> implements HasManyCollection<TChild> {
|
|
4297
5032
|
private readonly ctx;
|
|
4298
5033
|
private readonly meta;
|
|
@@ -4307,15 +5042,55 @@ declare class DefaultHasManyCollection<TChild> implements HasManyCollection<TChi
|
|
|
4307
5042
|
private items;
|
|
4308
5043
|
private readonly added;
|
|
4309
5044
|
private readonly removed;
|
|
5045
|
+
/**
|
|
5046
|
+
* Creates a new DefaultHasManyCollection instance.
|
|
5047
|
+
* @param ctx - The entity context
|
|
5048
|
+
* @param meta - The entity metadata
|
|
5049
|
+
* @param root - The root entity
|
|
5050
|
+
* @param relationName - The relation name
|
|
5051
|
+
* @param relation - The relation definition
|
|
5052
|
+
* @param rootTable - The root table definition
|
|
5053
|
+
* @param loader - The loader function for lazy loading
|
|
5054
|
+
* @param createEntity - Function to create entities from rows
|
|
5055
|
+
* @param localKey - The local key for the relation
|
|
5056
|
+
*/
|
|
4310
5057
|
constructor(ctx: EntityContext, meta: EntityMeta<TableDef>, root: unknown, relationName: string, relation: HasManyRelation, rootTable: TableDef, loader: () => Promise<Map<string, Rows$2>>, createEntity: (row: Record<string, unknown>) => TChild, localKey: string);
|
|
5058
|
+
/**
|
|
5059
|
+
* Loads the related entities if not already loaded.
|
|
5060
|
+
* @returns Promise resolving to the array of child entities
|
|
5061
|
+
*/
|
|
4311
5062
|
load(): Promise<TChild[]>;
|
|
5063
|
+
/**
|
|
5064
|
+
* Gets the current items in the collection.
|
|
5065
|
+
* @returns Array of child entities
|
|
5066
|
+
*/
|
|
4312
5067
|
getItems(): TChild[];
|
|
5068
|
+
/**
|
|
5069
|
+
* Adds a new child entity to the collection.
|
|
5070
|
+
* @param data - Partial data for the new entity
|
|
5071
|
+
* @returns The created entity
|
|
5072
|
+
*/
|
|
4313
5073
|
add(data: Partial<TChild>): TChild;
|
|
5074
|
+
/**
|
|
5075
|
+
* Attaches an existing entity to the collection.
|
|
5076
|
+
* @param entity - The entity to attach
|
|
5077
|
+
*/
|
|
4314
5078
|
attach(entity: TChild): void;
|
|
5079
|
+
/**
|
|
5080
|
+
* Removes an entity from the collection.
|
|
5081
|
+
* @param entity - The entity to remove
|
|
5082
|
+
*/
|
|
4315
5083
|
remove(entity: TChild): void;
|
|
5084
|
+
/**
|
|
5085
|
+
* Clears all entities from the collection.
|
|
5086
|
+
*/
|
|
4316
5087
|
clear(): void;
|
|
4317
5088
|
private get relationKey();
|
|
4318
5089
|
private hydrateFromCache;
|
|
5090
|
+
/**
|
|
5091
|
+
* Returns the items for JSON serialization.
|
|
5092
|
+
* @returns Array of child entities
|
|
5093
|
+
*/
|
|
4319
5094
|
toJSON(): TChild[];
|
|
4320
5095
|
}
|
|
4321
5096
|
|
|
@@ -4368,9 +5143,27 @@ declare class DefaultManyToManyCollection<TTarget> implements ManyToManyCollecti
|
|
|
4368
5143
|
toJSON(): TTarget[];
|
|
4369
5144
|
}
|
|
4370
5145
|
|
|
5146
|
+
/**
|
|
5147
|
+
* Executes a hydrated query using the ORM session.
|
|
5148
|
+
* @template TTable - The table type
|
|
5149
|
+
* @param session - The ORM session
|
|
5150
|
+
* @param qb - The select query builder
|
|
5151
|
+
* @returns Promise resolving to array of entity instances
|
|
5152
|
+
*/
|
|
4371
5153
|
declare function executeHydrated<TTable extends TableDef>(session: OrmSession, qb: SelectQueryBuilder<unknown, TTable>): Promise<EntityInstance<TTable>[]>;
|
|
5154
|
+
/**
|
|
5155
|
+
* Executes a hydrated query using execution and hydration contexts.
|
|
5156
|
+
* @template TTable - The table type
|
|
5157
|
+
* @param _execCtx - The execution context (unused)
|
|
5158
|
+
* @param hydCtx - The hydration context
|
|
5159
|
+
* @param qb - The select query builder
|
|
5160
|
+
* @returns Promise resolving to array of entity instances
|
|
5161
|
+
*/
|
|
4372
5162
|
declare function executeHydratedWithContexts<TTable extends TableDef>(_execCtx: ExecutionContext, hydCtx: HydrationContext, qb: SelectQueryBuilder<unknown, TTable>): Promise<EntityInstance<TTable>[]>;
|
|
4373
5163
|
|
|
5164
|
+
/**
|
|
5165
|
+
* Context object provided by standard decorators in newer TypeScript versions.
|
|
5166
|
+
*/
|
|
4374
5167
|
interface StandardDecoratorContext {
|
|
4375
5168
|
kind: string;
|
|
4376
5169
|
name?: string | symbol;
|
|
@@ -4378,21 +5171,38 @@ interface StandardDecoratorContext {
|
|
|
4378
5171
|
static?: boolean;
|
|
4379
5172
|
private?: boolean;
|
|
4380
5173
|
}
|
|
5174
|
+
/**
|
|
5175
|
+
* Dual-mode property decorator that supports both legacy and standard decorator syntax.
|
|
5176
|
+
*/
|
|
4381
5177
|
interface DualModePropertyDecorator {
|
|
4382
5178
|
(target: object, propertyKey: string | symbol): void;
|
|
4383
5179
|
(value: unknown, context: StandardDecoratorContext): void;
|
|
4384
5180
|
}
|
|
5181
|
+
/**
|
|
5182
|
+
* Dual-mode class decorator that supports both legacy and standard decorator syntax.
|
|
5183
|
+
*/
|
|
4385
5184
|
interface DualModeClassDecorator {
|
|
4386
5185
|
<TFunction extends Function>(value: TFunction): void | TFunction;
|
|
4387
5186
|
<TFunction extends Function>(value: TFunction, context: StandardDecoratorContext): void | TFunction;
|
|
4388
5187
|
}
|
|
4389
5188
|
|
|
5189
|
+
/**
|
|
5190
|
+
* Options for defining an entity.
|
|
5191
|
+
*/
|
|
4390
5192
|
interface EntityOptions {
|
|
4391
5193
|
tableName?: string;
|
|
4392
5194
|
hooks?: TableHooks;
|
|
4393
5195
|
}
|
|
5196
|
+
/**
|
|
5197
|
+
* Class decorator to mark a class as an entity and configure its table mapping.
|
|
5198
|
+
* @param options - Configuration options for the entity.
|
|
5199
|
+
* @returns A class decorator that registers the entity metadata.
|
|
5200
|
+
*/
|
|
4394
5201
|
declare function Entity(options?: EntityOptions): DualModeClassDecorator;
|
|
4395
5202
|
|
|
5203
|
+
/**
|
|
5204
|
+
* Options for defining a column in an entity.
|
|
5205
|
+
*/
|
|
4396
5206
|
interface ColumnOptions {
|
|
4397
5207
|
type: ColumnType;
|
|
4398
5208
|
args?: ColumnDef['args'];
|
|
@@ -4400,8 +5210,22 @@ interface ColumnOptions {
|
|
|
4400
5210
|
primary?: boolean;
|
|
4401
5211
|
tsType?: ColumnDef['tsType'];
|
|
4402
5212
|
}
|
|
5213
|
+
/**
|
|
5214
|
+
* Input type for column definitions, either as options object or direct ColumnDef.
|
|
5215
|
+
*/
|
|
4403
5216
|
type ColumnInput = ColumnOptions | ColumnDef;
|
|
5217
|
+
/**
|
|
5218
|
+
* Decorator to define a column on an entity property.
|
|
5219
|
+
* @param definition - The column definition or options.
|
|
5220
|
+
* @returns A property decorator that registers the column metadata.
|
|
5221
|
+
*/
|
|
4404
5222
|
declare function Column(definition: ColumnInput): DualModePropertyDecorator;
|
|
5223
|
+
/**
|
|
5224
|
+
* Decorator to define a primary key column on an entity property.
|
|
5225
|
+
* Sets the primary flag to true and delegates to Column decorator.
|
|
5226
|
+
* @param definition - The column definition or options.
|
|
5227
|
+
* @returns A property decorator that registers the primary key column metadata.
|
|
5228
|
+
*/
|
|
4405
5229
|
declare function PrimaryKey(definition: ColumnInput): DualModePropertyDecorator;
|
|
4406
5230
|
|
|
4407
5231
|
interface BaseRelationOptions {
|
|
@@ -4409,15 +5233,27 @@ interface BaseRelationOptions {
|
|
|
4409
5233
|
cascade?: CascadeMode;
|
|
4410
5234
|
localKey?: string;
|
|
4411
5235
|
}
|
|
5236
|
+
/**
|
|
5237
|
+
* Options for HasMany relation.
|
|
5238
|
+
*/
|
|
4412
5239
|
interface HasManyOptions extends BaseRelationOptions {
|
|
4413
5240
|
foreignKey: string;
|
|
4414
5241
|
}
|
|
5242
|
+
/**
|
|
5243
|
+
* Options for HasOne relation.
|
|
5244
|
+
*/
|
|
4415
5245
|
interface HasOneOptions extends BaseRelationOptions {
|
|
4416
5246
|
foreignKey: string;
|
|
4417
5247
|
}
|
|
5248
|
+
/**
|
|
5249
|
+
* Options for BelongsTo relation.
|
|
5250
|
+
*/
|
|
4418
5251
|
interface BelongsToOptions extends BaseRelationOptions {
|
|
4419
5252
|
foreignKey: string;
|
|
4420
5253
|
}
|
|
5254
|
+
/**
|
|
5255
|
+
* Options for BelongsToMany relation.
|
|
5256
|
+
*/
|
|
4421
5257
|
interface BelongsToManyOptions {
|
|
4422
5258
|
target: EntityOrTableTargetResolver;
|
|
4423
5259
|
pivotTable: EntityOrTableTargetResolver;
|
|
@@ -4429,13 +5265,48 @@ interface BelongsToManyOptions {
|
|
|
4429
5265
|
defaultPivotColumns?: string[];
|
|
4430
5266
|
cascade?: CascadeMode;
|
|
4431
5267
|
}
|
|
5268
|
+
/**
|
|
5269
|
+
* Decorator to define a HasMany relation on an entity property.
|
|
5270
|
+
* @param options - The relation options.
|
|
5271
|
+
* @returns A property decorator that registers the relation metadata.
|
|
5272
|
+
*/
|
|
4432
5273
|
declare function HasMany(options: HasManyOptions): DualModePropertyDecorator;
|
|
5274
|
+
/**
|
|
5275
|
+
* Decorator to define a HasOne relation on an entity property.
|
|
5276
|
+
* @param options - The relation options.
|
|
5277
|
+
* @returns A property decorator that registers the relation metadata.
|
|
5278
|
+
*/
|
|
4433
5279
|
declare function HasOne(options: HasOneOptions): DualModePropertyDecorator;
|
|
5280
|
+
/**
|
|
5281
|
+
* Decorator to define a BelongsTo relation on an entity property.
|
|
5282
|
+
* @param options - The relation options.
|
|
5283
|
+
* @returns A property decorator that registers the relation metadata.
|
|
5284
|
+
*/
|
|
4434
5285
|
declare function BelongsTo(options: BelongsToOptions): DualModePropertyDecorator;
|
|
5286
|
+
/**
|
|
5287
|
+
* Decorator to define a BelongsToMany relation on an entity property.
|
|
5288
|
+
* @param options - The relation options.
|
|
5289
|
+
* @returns A property decorator that registers the relation metadata.
|
|
5290
|
+
*/
|
|
4435
5291
|
declare function BelongsToMany(options: BelongsToManyOptions): DualModePropertyDecorator;
|
|
4436
5292
|
|
|
5293
|
+
/**
|
|
5294
|
+
* Bootstraps all entities by building their table definitions and relations.
|
|
5295
|
+
* @returns An array of table definitions for all bootstrapped entities.
|
|
5296
|
+
*/
|
|
4437
5297
|
declare const bootstrapEntities: () => TableDef[];
|
|
5298
|
+
/**
|
|
5299
|
+
* Gets the table definition for a given entity constructor.
|
|
5300
|
+
* Bootstraps entities if necessary.
|
|
5301
|
+
* @param ctor - The entity constructor.
|
|
5302
|
+
* @returns The table definition or undefined if not found.
|
|
5303
|
+
*/
|
|
4438
5304
|
declare const getTableDefFromEntity: <TTable extends TableDef = TableDef>(ctor: EntityConstructor) => TTable | undefined;
|
|
5305
|
+
/**
|
|
5306
|
+
* Creates a select query builder for the given entity.
|
|
5307
|
+
* @param ctor - The entity constructor.
|
|
5308
|
+
* @returns A select query builder for the entity.
|
|
5309
|
+
*/
|
|
4439
5310
|
declare const selectFromEntity: <TTable extends TableDef = TableDef>(ctor: EntityConstructor) => SelectQueryBuilder<unknown, TTable>;
|
|
4440
5311
|
/**
|
|
4441
5312
|
* Public API: opt-in ergonomic entity reference (decorator-level).
|
|
@@ -4588,4 +5459,4 @@ type PooledExecutorFactoryOptions<TConn> = {
|
|
|
4588
5459
|
*/
|
|
4589
5460
|
declare function createPooledExecutorFactory<TConn>(opts: PooledExecutorFactoryOptions<TConn>): DbExecutorFactory;
|
|
4590
5461
|
|
|
4591
|
-
export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count,
|
|
5462
|
+
export { type AliasRefNode, type AnyDomainEvent, type ArithmeticExpressionNode, type TableRef as AstTableRef, AsyncLocalStorage, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToManyRelation, type BelongsToOptions, type BelongsToReference, type BelongsToRelation, type BetweenExpressionNode, type BinaryExpressionNode, type CascadeMode, type CaseExpressionNode, type CheckConstraint, Column, type ColumnDef, type ColumnDiff, type ColumnInput, type ColumnNode, type ColumnOptions, type ColumnRef, type ColumnToTs, type ColumnType, type CreateTediousClientOptions, type DatabaseCheck, type DatabaseColumn, type DatabaseIndex, type DatabaseSchema, type DatabaseTable, type DbExecutor, type DbExecutorFactory, DefaultBelongsToReference, DefaultHasManyCollection, DefaultManyToManyCollection, type DefaultValue, DeleteQueryBuilder, type DialectName, type DomainEvent, DomainEventBus, type DomainEventHandler, Entity, type EntityContext, type EntityInstance, type EntityOptions, EntityStatus, type ExecutionContext, type ExistsExpressionNode, type ExpressionNode, type ExpressionVisitor, type ForeignKeyReference, type FunctionNode, type GroupConcatOptions, type HasDomainEvents, HasMany, type HasManyCollection, type HasManyOptions, type HasManyRelation, HasOne, type HasOneOptions, type HasOneReference, type HasOneRelation, type HydrationContext, type HydrationMetadata, type HydrationPivotPlan, type HydrationPlan, type HydrationRelationPlan, type InExpressionNode, type InExpressionRight, type IndexColumn, type IndexDef, type InferRow, type InitialHandlers, InsertQueryBuilder, type IntrospectOptions, type JsonPathNode, type LiteralNode, type LiteralValue, type LogicalExpressionNode, type ManyToManyCollection, type MssqlClientLike, MySqlDialect, type MysqlClientLike, type NullExpressionNode, type OperandNode, type OperandVisitor, Orm, type OrmDomainEvent, type OrmInterceptor, type OrmOptions, OrmSession, type OrmSessionOptions, Pool, type PoolAdapter, type PoolLease, type PoolOptions, type PooledConnectionAdapter, type PostgresClientLike, PostgresDialect, PrimaryKey, type QueryLogEntry, type QueryLogger, type QueryResult, type RawDefaultValue, type ReferentialAction, type RelationChange, type RelationChangeEntry, type RelationDef, type RelationKey, RelationKinds, type RelationMap, type RelationTargetTable, type RelationType, type RenderColumnOptions, type ScalarSubqueryNode, type SchemaChange, type SchemaChangeKind, type SchemaDiffOptions, type SchemaGenerateResult, type SchemaIntrospector, type SchemaPlan, SelectQueryBuilder, type SelectQueryInput, type SimpleQueryRunner, SqlServerDialect, type SqliteClientLike, SqliteDialect, type SynchronizeOptions, type TableDef, type TableHooks, type TableOptions, type TableRef$1 as TableRef, type TediousColumn, type TediousConnectionLike, type TediousModule, type TediousRequest, type TediousRequestCtor, type TediousTypes, type TrackedEntity, TypeScriptGenerator, UpdateQueryBuilder, type ValueOperandInput, type WindowFunctionNode, abs, acos, add, addDomainEvent, aliasRef, and, ascii, asin, atan, atan2, avg, belongsTo, belongsToMany, between, bootstrapEntities, caseWhen, ceil, ceiling, char, charLength, clearExpressionDispatchers, clearOperandDispatchers, col, columnOperand, concat, concatWs, correlateBy, cos, cot, count, createEntityFromRow, createEntityProxy, createExecutorFromQueryRunner, createMssqlExecutor, createMysqlExecutor, createPooledExecutorFactory, createPostgresExecutor, createQueryLoggingExecutor, createSqliteExecutor, createTediousExecutor, createTediousMssqlClient, currentDate, currentTime, dateAdd, dateDiff, dateFormat, dateSub, dateTrunc, day, dayOfWeek, defineTable, degrees, denseRank, diffSchema, div, endOfMonth, entityRef, eq, esel, executeHydrated, executeHydratedWithContexts, exists, exp, extract, firstValue, floor, fromUnixTime, generateCreateTableSql, generateSchemaSql, getColumn, getSchemaIntrospector, getTableDefFromEntity, groupConcat, gt, gte, hasMany, hasOne, hydrateRows, inList, inSubquery, instr, introspectSchema, isCaseExpressionNode, isExpressionSelectionNode, isFunctionNode, isNotNull, isNull, isOperandNode, isValueOperandInput, isWindowFunctionNode, 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, mul, neq, notBetween, notExists, notInList, notInSubquery, notLike, now, ntile, or, outerRef, pi, position, pow, power, radians, rand, random, rank, registerExpressionDispatcher, registerOperandDispatcher, registerSchemaIntrospector, renderColumnDefinition, repeat, replace, right, round, rowNumber, rowsToQueryResult, rpad, rtrim, sel, selectFromEntity, sign, sin, space, sqrt, sub, substr, sum, synchronizeSchema, tableRef, tan, toColumnRef, toTableRef, trim, trunc, truncate, unixTimestamp, upper, utcNow, valueToOperand, visitExpression, visitOperand, weekOfYear, windowFunction, year };
|