nodecommons-esm-database 0.0.9 → 0.0.11
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,5 +1,6 @@
|
|
|
1
|
-
import { CommonsFixedDate, commonsTypeAssertNumber } from 'tscommons-esm-core';
|
|
1
|
+
import { CommonsFixedDate, commonsTypeAssertDate, commonsTypeAssertNumber } from 'tscommons-esm-core';
|
|
2
2
|
import { ECommonsDatabaseEngine } from '../enums/ecommons-database-engine.mjs';
|
|
3
|
+
import { isTCommonsDatabaseInternalPostgresInterval } from '../types/tcommons-database-postgres-interval.mjs';
|
|
3
4
|
import { CommonsDatabaseType } from './commons-database-type.mjs';
|
|
4
5
|
export class CommonsDatabaseTypeFixedDate extends CommonsDatabaseType {
|
|
5
6
|
renderEngineType(engine) {
|
|
@@ -23,14 +24,14 @@ export class CommonsDatabaseTypeFixedDate extends CommonsDatabaseType {
|
|
|
23
24
|
super.assertDbValue(value, engine);
|
|
24
25
|
if (value === undefined || value === null)
|
|
25
26
|
return;
|
|
27
|
+
if (engine === ECommonsDatabaseEngine.POSTGRES && isTCommonsDatabaseInternalPostgresInterval(value))
|
|
28
|
+
return;
|
|
26
29
|
if (engine === ECommonsDatabaseEngine.SQLITE) {
|
|
27
30
|
// SQLite stores its timestamps as longs
|
|
28
31
|
commonsTypeAssertNumber(value);
|
|
32
|
+
return;
|
|
29
33
|
}
|
|
30
|
-
|
|
31
|
-
if (!CommonsFixedDate.is(value))
|
|
32
|
-
throw new Error('Assertion fail: variable is not a CommonsFixedDate instance');
|
|
33
|
-
}
|
|
34
|
+
commonsTypeAssertDate(value);
|
|
34
35
|
}
|
|
35
36
|
encode(value, _engine) {
|
|
36
37
|
// No need to convert to number for SQLLITE; it seems to do it itself
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commons-database-type-fixed-date.mjs","sourceRoot":"","sources":["../../src/classes/commons-database-type-fixed-date.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"commons-database-type-fixed-date.mjs","sourceRoot":"","sources":["../../src/classes/commons-database-type-fixed-date.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAE9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,MAAM,OAAO,4BAA6B,SAAQ,mBAAkD;IACzF,gBAAgB,CAAC,MAA8B;QACxD,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,sBAAsB,CAAC,KAAK,CAAC;YAClC,KAAK,sBAAsB,CAAC,QAAQ,CAAC;YACrC,KAAK,sBAAsB,CAAC,MAAM;gBACjC,OAAO,MAAM,CAAC;YACf;gBACC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;IACF,CAAC;IAEe,WAAW,CAAC,KAAiC;QAC5D,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO;QAEhC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjH,CAAC;IAEe,aAAa,CAC3B,KAAiC,EACjC,MAA8B;QAE/B,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO;QAElD,IAAI,MAAM,KAAK,sBAAsB,CAAC,QAAQ,IAAI,0CAA0C,CAAC,KAAK,CAAC;YAAE,OAAO;QAE5G,IAAI,MAAM,KAAK,sBAAsB,CAAC,MAAM,EAAE,CAAC;YAC9C,wCAAwC;YACxC,uBAAuB,CAAC,KAAK,CAAC,CAAC;YAE/B,OAAO;QACR,CAAC;QAED,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,MAAM,CAAC,KAAuB,EAAE,OAA+B;QACxE,qEAAqE;QAErE,MAAM,KAAK,GAAqB,KAAK,CAAC,KAAK,CAAC;QAC5C,KAAK,CAAC,aAAa,EAAE,CAAC;QAEtB,OAAO,KAAK,CAAC,OAAO,CAAC;IACtB,CAAC;IAES,MAAM,CAAC,KAAkB,EAAE,MAA8B;QAClE,IAAI,MAAM,KAAK,sBAAsB,CAAC,MAAM,EAAE,CAAC;YAC9C,wCAAwC;YACxC,MAAM,IAAI,GAAqB,gBAAgB,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,KAAe,CAAC,CAAC,CAAC;YACvF,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACb,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,GAAqB,gBAAgB,CAAC,WAAW,CAAC,KAAa,CAAC,CAAC;YAC3E,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACb,CAAC;IACF,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodecommons-esm-database",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"tsc": "./node_modules/typescript/bin/tsc",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"dist/**/*"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"tscommons-esm-core": "^0.0.
|
|
29
|
+
"tscommons-esm-core": "^0.0.5"
|
|
30
30
|
}
|
|
31
31
|
}
|