@oino-ts/db 0.3.2 → 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.
@@ -1,95 +1,95 @@
1
- /** Set the name of the OINO ID field (default \_OINOID\_) */
2
-
3
- export class OINODbConfig {
4
- /** Name of the synthetic OINO ID field */
5
- static OINODB_ID_FIELD:string = "_OINOID_"
6
- /** Private key separator of the synthetic OINO ID field */
7
- static OINODB_ID_SEPARATOR:string = "_"
8
- private static OINODB_ID_SEPARATOR_ESCAPED:string = "%"
9
-
10
- /** Name of the OINODbSqlFilter-parameter in request */
11
- static OINODB_SQL_FILTER_PARAM:string = "oinosqlfilter"
12
-
13
- /** Name of the OINODbSqlOrder-parameter in request */
14
- static OINODB_SQL_ORDER_PARAM:string = "oinosqlorder"
15
-
16
- /** Name of the OINODbSqlLimit-parameter in request */
17
- static OINODB_SQL_LIMIT_PARAM:string = "oinosqllimit"
18
-
19
- /** Name of the OINODbSqlAggregate-parameter in request */
20
- static OINODB_SQL_AGGREGATE_PARAM:string = "oinosqlaggregate"
21
-
22
- /**
23
- * Set the name of the OINO ID field
24
- * @param idField name of the OINO ID field
25
- */
26
- static setOinoIdField(idField: string) {
27
- if (idField) {
28
- OINODbConfig.OINODB_ID_FIELD = idField;
29
- }
30
- }
31
-
32
- /**
33
- * Set the separator character of the OINO ID field
34
- * @param idSeparator character to use as separator of id parts
35
- */
36
- static setOinoIdSeparator(idSeparator: string) {
37
- if (idSeparator && (idSeparator.length == 1)) {
38
- OINODbConfig.OINODB_ID_SEPARATOR = idSeparator;
39
- OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED = '%' + idSeparator.charCodeAt(0).toString(16);
40
- }
41
- }
42
-
43
- /**
44
- * Print OINO ID for primary key values.
45
- *
46
- * @param primaryKeys an array of primary key values.
47
- *
48
- */
49
- static printOINOId(primaryKeys:string[]):string {
50
- let result:string = ""
51
- for (let i=0; i< primaryKeys.length; i++) {
52
- if (i > 0) {
53
- result += OINODbConfig.OINODB_ID_SEPARATOR
54
- }
55
- result += encodeURIComponent(primaryKeys[i] as string).replaceAll(OINODbConfig.OINODB_ID_SEPARATOR, OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED)
56
- }
57
- return result
58
- }
59
-
60
- /**
61
- * Set the name of the OINODbSqlFilter-param field
62
- *
63
- * @param sqlFilterParam name of the http parameter with `OINODbSqlFilter` definition
64
- *
65
- */
66
- static setOinoSqlFilterParam(sqlFilterParam: string) {
67
- if (sqlFilterParam) {
68
- OINODbConfig.OINODB_SQL_FILTER_PARAM = sqlFilterParam;
69
- }
70
- }
71
-
72
- /**
73
- * Set the name of the OINODbSqlOrder-param field
74
- *
75
- * @param sqlOrderParam name of the http parameter with `OINODbSqlOrder` definition
76
- *
77
- */
78
- static setOinoSqlOrderParam(sqlOrderParam: string) {
79
- if (sqlOrderParam) {
80
- OINODbConfig.OINODB_SQL_ORDER_PARAM = sqlOrderParam;
81
- }
82
- }
83
-
84
- /**
85
- * Set the name of the OINODbSqlLimit-param field
86
- *
87
- * @param sqlLimitParam name of the http parameter with `OINODbSqlLimit` definition
88
- *
89
- */
90
- static setOinoSqlLimitParam(sqlLimitParam: string) {
91
- if (sqlLimitParam) {
92
- OINODbConfig.OINODB_SQL_LIMIT_PARAM = sqlLimitParam;
93
- }
94
- }
95
- }
1
+ /** Set the name of the OINO ID field (default \_OINOID\_) */
2
+
3
+ export class OINODbConfig {
4
+ /** Name of the synthetic OINO ID field */
5
+ static OINODB_ID_FIELD:string = "_OINOID_"
6
+ /** Private key separator of the synthetic OINO ID field */
7
+ static OINODB_ID_SEPARATOR:string = "_"
8
+ private static OINODB_ID_SEPARATOR_ESCAPED:string = "%"
9
+
10
+ /** Name of the OINODbSqlFilter-parameter in request */
11
+ static OINODB_SQL_FILTER_PARAM:string = "oinosqlfilter"
12
+
13
+ /** Name of the OINODbSqlOrder-parameter in request */
14
+ static OINODB_SQL_ORDER_PARAM:string = "oinosqlorder"
15
+
16
+ /** Name of the OINODbSqlLimit-parameter in request */
17
+ static OINODB_SQL_LIMIT_PARAM:string = "oinosqllimit"
18
+
19
+ /** Name of the OINODbSqlAggregate-parameter in request */
20
+ static OINODB_SQL_AGGREGATE_PARAM:string = "oinosqlaggregate"
21
+
22
+ /**
23
+ * Set the name of the OINO ID field
24
+ * @param idField name of the OINO ID field
25
+ */
26
+ static setOinoIdField(idField: string) {
27
+ if (idField) {
28
+ OINODbConfig.OINODB_ID_FIELD = idField;
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Set the separator character of the OINO ID field
34
+ * @param idSeparator character to use as separator of id parts
35
+ */
36
+ static setOinoIdSeparator(idSeparator: string) {
37
+ if (idSeparator && (idSeparator.length == 1)) {
38
+ OINODbConfig.OINODB_ID_SEPARATOR = idSeparator;
39
+ OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED = '%' + idSeparator.charCodeAt(0).toString(16);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Print OINO ID for primary key values.
45
+ *
46
+ * @param primaryKeys an array of primary key values.
47
+ *
48
+ */
49
+ static printOINOId(primaryKeys:string[]):string {
50
+ let result:string = ""
51
+ for (let i=0; i< primaryKeys.length; i++) {
52
+ if (i > 0) {
53
+ result += OINODbConfig.OINODB_ID_SEPARATOR
54
+ }
55
+ result += encodeURIComponent(primaryKeys[i] as string).replaceAll(OINODbConfig.OINODB_ID_SEPARATOR, OINODbConfig.OINODB_ID_SEPARATOR_ESCAPED)
56
+ }
57
+ return result
58
+ }
59
+
60
+ /**
61
+ * Set the name of the OINODbSqlFilter-param field
62
+ *
63
+ * @param sqlFilterParam name of the http parameter with `OINODbSqlFilter` definition
64
+ *
65
+ */
66
+ static setOinoSqlFilterParam(sqlFilterParam: string) {
67
+ if (sqlFilterParam) {
68
+ OINODbConfig.OINODB_SQL_FILTER_PARAM = sqlFilterParam;
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Set the name of the OINODbSqlOrder-param field
74
+ *
75
+ * @param sqlOrderParam name of the http parameter with `OINODbSqlOrder` definition
76
+ *
77
+ */
78
+ static setOinoSqlOrderParam(sqlOrderParam: string) {
79
+ if (sqlOrderParam) {
80
+ OINODbConfig.OINODB_SQL_ORDER_PARAM = sqlOrderParam;
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Set the name of the OINODbSqlLimit-param field
86
+ *
87
+ * @param sqlLimitParam name of the http parameter with `OINODbSqlLimit` definition
88
+ *
89
+ */
90
+ static setOinoSqlLimitParam(sqlLimitParam: string) {
91
+ if (sqlLimitParam) {
92
+ OINODbConfig.OINODB_SQL_LIMIT_PARAM = sqlLimitParam;
93
+ }
94
+ }
95
+ }