forge-sql-orm 2.0.19 → 2.0.21

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.
@@ -267,6 +267,15 @@ function processNullBranches(obj) {
267
267
  }
268
268
  return allNull ? null : result;
269
269
  }
270
+ function formatLimitOffset(limitOrOffset) {
271
+ if (typeof limitOrOffset !== "number" || isNaN(limitOrOffset)) {
272
+ throw new Error("limitOrOffset must be a valid number");
273
+ }
274
+ return sql.raw(`${limitOrOffset}`);
275
+ }
276
+ function nextVal(sequenceName) {
277
+ return sql`SELECT NEXT VALUE FOR ${sequenceName} AS id`;
278
+ }
270
279
  class ForgeSQLCrudOperations {
271
280
  forgeOperations;
272
281
  options;
@@ -918,10 +927,11 @@ class ForgeSQLAnalyseOperation {
918
927
  * Retrieves and analyzes slow queries from the database.
919
928
  * @returns {Promise<SlowQueryNormalized[]>} The normalized slow query data
920
929
  */
930
+ // CLUSTER_SLOW_QUERY STATISTICS
921
931
  async analyzeSlowQueries() {
922
932
  const results = await this.forgeOperations.fetch().executeRawSQL(`
923
933
  SELECT *
924
- FROM information_schema.slow_query
934
+ FROM information_schema.slow_query
925
935
  ORDER BY time DESC
926
936
  `);
927
937
  return results.map((row) => this.normalizeSlowQuery(row));
@@ -1336,6 +1346,7 @@ export {
1336
1346
  forgeSystemTables,
1337
1347
  forgeTimeString,
1338
1348
  forgeTimestampString,
1349
+ formatLimitOffset,
1339
1350
  generateDropTableStatements,
1340
1351
  getHttpResponse,
1341
1352
  getPrimaryKeys,
@@ -1344,6 +1355,7 @@ export {
1344
1355
  mapSelectAllFieldsToAlias,
1345
1356
  mapSelectFieldsWithAlias,
1346
1357
  migrations,
1358
+ nextVal,
1347
1359
  parseDateTime,
1348
1360
  patchDbWithSelectAliased
1349
1361
  };