metal-orm 1.0.97 → 1.0.98
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/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/hydration/types.ts +57 -57
- package/src/orm/entity-relations.ts +19 -19
- package/src/orm/lazy-batch/belongs-to-many.ts +134 -134
- package/src/orm/lazy-batch/belongs-to.ts +108 -108
- package/src/orm/lazy-batch/has-many.ts +69 -69
- package/src/orm/lazy-batch/has-one.ts +68 -68
- package/src/orm/lazy-batch/shared.ts +125 -125
- package/src/orm/save-graph.ts +48 -48
- package/src/query-builder/column-selector.ts +9 -9
- package/src/query-builder/hydration-manager.ts +353 -353
- package/src/query-builder/hydration-planner.ts +22 -22
- package/src/query-builder/relation-conditions.ts +80 -80
- package/src/query-builder/select/projection-facet.ts +23 -23
- package/src/query-builder/select-query-state.ts +213 -213
- package/src/query-builder/select.ts +1155 -1133
- package/src/schema/relation.ts +22 -22
package/dist/index.d.cts
CHANGED
|
@@ -4247,6 +4247,21 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4247
4247
|
page: number;
|
|
4248
4248
|
pageSize: number;
|
|
4249
4249
|
}): Promise<PaginatedResult<T>>;
|
|
4250
|
+
/**
|
|
4251
|
+
* Executes the query and returns an array of values for a single column.
|
|
4252
|
+
* This is a convenience method to avoid manual `.map(r => r.column)`.
|
|
4253
|
+
*
|
|
4254
|
+
* @param column - The column name to extract
|
|
4255
|
+
* @param ctx - ORM session context
|
|
4256
|
+
* @returns Promise of an array containing only the values of the specified column
|
|
4257
|
+
* @example
|
|
4258
|
+
* const acronyms = await selectFromEntity(Organization)
|
|
4259
|
+
* .select('acronym')
|
|
4260
|
+
* .distinct(O.acronym)
|
|
4261
|
+
* .pluck('acronym', session);
|
|
4262
|
+
* // ['NASA', 'UN', 'WHO']
|
|
4263
|
+
*/
|
|
4264
|
+
pluck<K extends keyof T & string>(column: K, ctx: OrmSession): Promise<T[K][]>;
|
|
4250
4265
|
/**
|
|
4251
4266
|
* Executes the query with provided execution and hydration contexts
|
|
4252
4267
|
* @param execCtx - Execution context
|
package/dist/index.d.ts
CHANGED
|
@@ -4247,6 +4247,21 @@ declare class SelectQueryBuilder<T = EntityInstance<TableDef>, TTable extends Ta
|
|
|
4247
4247
|
page: number;
|
|
4248
4248
|
pageSize: number;
|
|
4249
4249
|
}): Promise<PaginatedResult<T>>;
|
|
4250
|
+
/**
|
|
4251
|
+
* Executes the query and returns an array of values for a single column.
|
|
4252
|
+
* This is a convenience method to avoid manual `.map(r => r.column)`.
|
|
4253
|
+
*
|
|
4254
|
+
* @param column - The column name to extract
|
|
4255
|
+
* @param ctx - ORM session context
|
|
4256
|
+
* @returns Promise of an array containing only the values of the specified column
|
|
4257
|
+
* @example
|
|
4258
|
+
* const acronyms = await selectFromEntity(Organization)
|
|
4259
|
+
* .select('acronym')
|
|
4260
|
+
* .distinct(O.acronym)
|
|
4261
|
+
* .pluck('acronym', session);
|
|
4262
|
+
* // ['NASA', 'UN', 'WHO']
|
|
4263
|
+
*/
|
|
4264
|
+
pluck<K extends keyof T & string>(column: K, ctx: OrmSession): Promise<T[K][]>;
|
|
4250
4265
|
/**
|
|
4251
4266
|
* Executes the query with provided execution and hydration contexts
|
|
4252
4267
|
* @param execCtx - Execution context
|
package/dist/index.js
CHANGED
|
@@ -7224,6 +7224,24 @@ var SelectQueryBuilder = class _SelectQueryBuilder {
|
|
|
7224
7224
|
const builder = this.ensureDefaultSelection();
|
|
7225
7225
|
return executePagedQuery(builder, session, options, (sess) => builder.count(sess));
|
|
7226
7226
|
}
|
|
7227
|
+
/**
|
|
7228
|
+
* Executes the query and returns an array of values for a single column.
|
|
7229
|
+
* This is a convenience method to avoid manual `.map(r => r.column)`.
|
|
7230
|
+
*
|
|
7231
|
+
* @param column - The column name to extract
|
|
7232
|
+
* @param ctx - ORM session context
|
|
7233
|
+
* @returns Promise of an array containing only the values of the specified column
|
|
7234
|
+
* @example
|
|
7235
|
+
* const acronyms = await selectFromEntity(Organization)
|
|
7236
|
+
* .select('acronym')
|
|
7237
|
+
* .distinct(O.acronym)
|
|
7238
|
+
* .pluck('acronym', session);
|
|
7239
|
+
* // ['NASA', 'UN', 'WHO']
|
|
7240
|
+
*/
|
|
7241
|
+
async pluck(column, ctx) {
|
|
7242
|
+
const rows = await this.executePlain(ctx);
|
|
7243
|
+
return rows.map((r) => r[column]);
|
|
7244
|
+
}
|
|
7227
7245
|
/**
|
|
7228
7246
|
* Executes the query with provided execution and hydration contexts
|
|
7229
7247
|
* @param execCtx - Execution context
|