@rivascva/dt-idl 1.1.142 → 1.1.143

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.
Files changed (2) hide show
  1. package/go/psql/utils.go +2 -2
  2. package/package.json +1 -1
package/go/psql/utils.go CHANGED
@@ -65,14 +65,14 @@ func GetSelectAllQueryWithLimitAndOrderBy(table string, limit uint, orderByColum
65
65
  return builder.ToSql()
66
66
  }
67
67
 
68
- // GetSelectEveryNthRowQuery builds and returns the query and arguments to perform a select columns query that returns every nth row.
68
+ // GetSelectEveryNthRowQuery builds and returns the query and arguments to perform a select columns query that returns every nth row (includes the first row).
69
69
  // Provide a where map to specify which rows to pre-select. A nil value will pre-select all rows.
70
70
  func GetSelectEveryNthRowQuery(table string, columns []string, orderByColumn string, n int, where ...Where) (string, []any, error) {
71
71
  subquery := sq.Select("*", fmt.Sprintf("row_number() OVER (ORDER BY %s) AS row_num", orderByColumn)).From(table)
72
72
  for _, mp := range where {
73
73
  subquery = subquery.Where(mp)
74
74
  }
75
- builder := sq.Select(columns...).FromSelect(subquery, "t").Where(fmt.Sprintf("row_num %% %d = 0", n))
75
+ builder := sq.Select(columns...).FromSelect(subquery, "t").Where(fmt.Sprintf("(row_num - 1) %% %d = 0", n))
76
76
  return builder.ToSql()
77
77
  }
78
78
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.142",
3
+ "version": "1.1.143",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",