@oino-ts/db 0.3.3 → 0.3.4
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/cjs/OINODb.js +3 -3
- package/dist/cjs/OINODbSqlParams.js +6 -5
- package/dist/esm/OINODb.js +3 -3
- package/dist/esm/OINODbSqlParams.js +6 -5
- package/dist/types/OINODbSqlParams.d.ts +2 -2
- package/package.json +36 -36
- package/src/OINODb.ts +291 -291
- package/src/OINODbApi.test.ts +411 -411
- package/src/OINODbApi.ts +384 -384
- package/src/OINODbConfig.ts +95 -95
- package/src/OINODbDataField.ts +382 -382
- package/src/OINODbDataModel.ts +289 -289
- package/src/OINODbFactory.ts +124 -124
- package/src/OINODbModelSet.ts +298 -298
- package/src/OINODbParser.ts +457 -457
- package/src/OINODbSqlParams.ts +438 -437
- package/src/OINODbSwagger.ts +208 -208
- package/src/index.ts +130 -130
- package/README.md +0 -190
package/dist/cjs/OINODb.js
CHANGED
|
@@ -41,15 +41,15 @@ class OINODb {
|
|
|
41
41
|
if (whereCondition != "") {
|
|
42
42
|
result += " WHERE " + whereCondition;
|
|
43
43
|
}
|
|
44
|
+
if (groupByCondition != "") {
|
|
45
|
+
result += " GROUP BY " + groupByCondition;
|
|
46
|
+
}
|
|
44
47
|
if (orderCondition != "") {
|
|
45
48
|
result += " ORDER BY " + orderCondition;
|
|
46
49
|
}
|
|
47
50
|
if (limitCondition != "") {
|
|
48
51
|
result += " LIMIT " + limitCondition;
|
|
49
52
|
}
|
|
50
|
-
if (groupByCondition != "") {
|
|
51
|
-
result += " GROUP BY " + groupByCondition;
|
|
52
|
-
}
|
|
53
53
|
result += ";";
|
|
54
54
|
// OINOLog.debug("OINODb.printSqlSelect", {result:result})
|
|
55
55
|
return result;
|
|
@@ -359,12 +359,12 @@ class OINODbSqlAggregate {
|
|
|
359
359
|
/**
|
|
360
360
|
* Constructor for `OINODbSqlAggregate`.
|
|
361
361
|
*
|
|
362
|
-
* @param
|
|
362
|
+
* @param functions aggregate function to use
|
|
363
363
|
* @param fields fields to aggregate
|
|
364
364
|
*
|
|
365
365
|
*/
|
|
366
|
-
constructor(
|
|
367
|
-
this._functions =
|
|
366
|
+
constructor(functions, fields) {
|
|
367
|
+
this._functions = functions;
|
|
368
368
|
this._fields = fields;
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
@@ -423,11 +423,12 @@ class OINODbSqlAggregate {
|
|
|
423
423
|
let result = "";
|
|
424
424
|
for (let i = 0; i < dataModel.fields.length; i++) {
|
|
425
425
|
const aggregate_index = this._fields.indexOf(dataModel.fields[i].name);
|
|
426
|
+
const col_name = dataModel.fields[i].printSqlColumnName();
|
|
426
427
|
if (aggregate_index >= 0) {
|
|
427
|
-
result += this._functions[aggregate_index] + "(" +
|
|
428
|
+
result += this._functions[aggregate_index] + "(" + col_name + ") as " + col_name + ",";
|
|
428
429
|
}
|
|
429
430
|
else {
|
|
430
|
-
result +=
|
|
431
|
+
result += col_name + ",";
|
|
431
432
|
}
|
|
432
433
|
}
|
|
433
434
|
index_js_1.OINOLog.debug("OINODbSqlAggregate.printSqlColumnNames", { result: result });
|
package/dist/esm/OINODb.js
CHANGED
|
@@ -38,15 +38,15 @@ export class OINODb {
|
|
|
38
38
|
if (whereCondition != "") {
|
|
39
39
|
result += " WHERE " + whereCondition;
|
|
40
40
|
}
|
|
41
|
+
if (groupByCondition != "") {
|
|
42
|
+
result += " GROUP BY " + groupByCondition;
|
|
43
|
+
}
|
|
41
44
|
if (orderCondition != "") {
|
|
42
45
|
result += " ORDER BY " + orderCondition;
|
|
43
46
|
}
|
|
44
47
|
if (limitCondition != "") {
|
|
45
48
|
result += " LIMIT " + limitCondition;
|
|
46
49
|
}
|
|
47
|
-
if (groupByCondition != "") {
|
|
48
|
-
result += " GROUP BY " + groupByCondition;
|
|
49
|
-
}
|
|
50
50
|
result += ";";
|
|
51
51
|
// OINOLog.debug("OINODb.printSqlSelect", {result:result})
|
|
52
52
|
return result;
|
|
@@ -353,12 +353,12 @@ export class OINODbSqlAggregate {
|
|
|
353
353
|
/**
|
|
354
354
|
* Constructor for `OINODbSqlAggregate`.
|
|
355
355
|
*
|
|
356
|
-
* @param
|
|
356
|
+
* @param functions aggregate function to use
|
|
357
357
|
* @param fields fields to aggregate
|
|
358
358
|
*
|
|
359
359
|
*/
|
|
360
|
-
constructor(
|
|
361
|
-
this._functions =
|
|
360
|
+
constructor(functions, fields) {
|
|
361
|
+
this._functions = functions;
|
|
362
362
|
this._fields = fields;
|
|
363
363
|
}
|
|
364
364
|
/**
|
|
@@ -417,11 +417,12 @@ export class OINODbSqlAggregate {
|
|
|
417
417
|
let result = "";
|
|
418
418
|
for (let i = 0; i < dataModel.fields.length; i++) {
|
|
419
419
|
const aggregate_index = this._fields.indexOf(dataModel.fields[i].name);
|
|
420
|
+
const col_name = dataModel.fields[i].printSqlColumnName();
|
|
420
421
|
if (aggregate_index >= 0) {
|
|
421
|
-
result += this._functions[aggregate_index] + "(" +
|
|
422
|
+
result += this._functions[aggregate_index] + "(" + col_name + ") as " + col_name + ",";
|
|
422
423
|
}
|
|
423
424
|
else {
|
|
424
|
-
result +=
|
|
425
|
+
result += col_name + ",";
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
428
|
OINOLog.debug("OINODbSqlAggregate.printSqlColumnNames", { result: result });
|
|
@@ -167,11 +167,11 @@ export declare class OINODbSqlAggregate {
|
|
|
167
167
|
/**
|
|
168
168
|
* Constructor for `OINODbSqlAggregate`.
|
|
169
169
|
*
|
|
170
|
-
* @param
|
|
170
|
+
* @param functions aggregate function to use
|
|
171
171
|
* @param fields fields to aggregate
|
|
172
172
|
*
|
|
173
173
|
*/
|
|
174
|
-
constructor(
|
|
174
|
+
constructor(functions: OINODbSqlAggregateFunctions[], fields: string[]);
|
|
175
175
|
/**
|
|
176
176
|
* Constructor for `OINODbSqlAggregate` as parser of http parameter.
|
|
177
177
|
*
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@oino-ts/db",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "OINO TS library package for publishing an SQL database tables as a REST API.",
|
|
5
|
-
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
|
-
"license": "MPL-2.0",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/pragmatta/oino-ts.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"sql",
|
|
13
|
-
"database",
|
|
14
|
-
"rest-api",
|
|
15
|
-
"typescript",
|
|
16
|
-
"library"
|
|
17
|
-
],
|
|
18
|
-
"main": "./dist/cjs/index.js",
|
|
19
|
-
"module": "./dist/esm/index.js",
|
|
20
|
-
"types": "./dist/types/index.d.ts",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@oino-ts/common": "0.3.
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^20.14.10",
|
|
26
|
-
"@types/bun": "^1.1.14",
|
|
27
|
-
"@oino-ts/types": "0.3.
|
|
28
|
-
"typedoc": "^0.25.13"
|
|
29
|
-
},
|
|
30
|
-
"files": [
|
|
31
|
-
"src/*.ts",
|
|
32
|
-
"dist/cjs/*.js",
|
|
33
|
-
"dist/esm/*.js",
|
|
34
|
-
"dist/types/*.d.ts"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@oino-ts/db",
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "OINO TS library package for publishing an SQL database tables as a REST API.",
|
|
5
|
+
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
|
+
"license": "MPL-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/pragmatta/oino-ts.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"sql",
|
|
13
|
+
"database",
|
|
14
|
+
"rest-api",
|
|
15
|
+
"typescript",
|
|
16
|
+
"library"
|
|
17
|
+
],
|
|
18
|
+
"main": "./dist/cjs/index.js",
|
|
19
|
+
"module": "./dist/esm/index.js",
|
|
20
|
+
"types": "./dist/types/index.d.ts",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@oino-ts/common": "0.3.4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.14.10",
|
|
26
|
+
"@types/bun": "^1.1.14",
|
|
27
|
+
"@oino-ts/types": "0.3.4",
|
|
28
|
+
"typedoc": "^0.25.13"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"src/*.ts",
|
|
32
|
+
"dist/cjs/*.js",
|
|
33
|
+
"dist/esm/*.js",
|
|
34
|
+
"dist/types/*.d.ts"
|
|
35
|
+
]
|
|
36
|
+
}
|