dolphindb 2.0.517 → 2.0.520
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/browser.d.ts +20 -8
- package/browser.js +80 -34
- package/browser.js.map +1 -1
- package/index.d.ts +20 -8
- package/index.js +79 -33
- package/index.js.map +1 -1
- package/package.json +10 -8
package/browser.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ export declare enum DdbForm {
|
|
|
8
8
|
dict = 5,
|
|
9
9
|
table = 6,
|
|
10
10
|
chart = 7,
|
|
11
|
-
chunk = 8
|
|
11
|
+
chunk = 8,
|
|
12
|
+
/** sysobj */
|
|
13
|
+
object = 9
|
|
12
14
|
}
|
|
13
15
|
/** DolphinDB DataType
|
|
14
16
|
对应的 array vector 类型为 64 + 基本类型
|
|
@@ -250,20 +252,28 @@ export declare class DdbSetString extends DdbObj<string[]> {
|
|
|
250
252
|
export declare class DdbTable extends DdbObj<DdbObj[]> {
|
|
251
253
|
constructor(columns: DdbObj[], name?: string);
|
|
252
254
|
}
|
|
253
|
-
export declare function
|
|
255
|
+
export declare function date2ms(date: number | null): number;
|
|
256
|
+
export declare function date2str(date: number | null, format?: string): string;
|
|
257
|
+
export declare function month2ms(month: number | null): number | null;
|
|
254
258
|
export declare function month2str(month: number | null): string;
|
|
255
|
-
export declare function
|
|
259
|
+
export declare function time2ms(time: number | null): number | null;
|
|
260
|
+
export declare function time2str(time: number | null, format?: string): string;
|
|
261
|
+
export declare function minute2ms(minute: number | null): number | null;
|
|
256
262
|
export declare function minute2str(minute: number | null, format?: string): string;
|
|
263
|
+
export declare function second2ms(second: number | null): number | null;
|
|
257
264
|
export declare function second2str(second: number | null, format?: string): string;
|
|
258
|
-
export declare function
|
|
265
|
+
export declare function datetime2ms(datetime: number | null): number | null;
|
|
266
|
+
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
267
|
+
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
259
268
|
/** format timestamp (bigint) to string
|
|
260
269
|
- timestamp: bigint value
|
|
261
270
|
- format?:
|
|
262
271
|
format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
|
|
263
272
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
264
273
|
*/
|
|
265
|
-
export declare function timestamp2str(timestamp: bigint, format?: string): string;
|
|
266
|
-
export declare function
|
|
274
|
+
export declare function timestamp2str(timestamp: bigint | null, format?: string): string;
|
|
275
|
+
export declare function datehour2ms(datehour: number | null): number | null;
|
|
276
|
+
export declare function datehour2str(datehour: number | null, format?: string): string;
|
|
267
277
|
/** parse timestamp string to bigint value
|
|
268
278
|
- str: timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
269
279
|
- format?:
|
|
@@ -271,7 +281,9 @@ export declare function datehour2str(datehour: number, format?: string): string;
|
|
|
271
281
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
272
282
|
*/
|
|
273
283
|
export declare function str2timestamp(str: string, format?: string): bigint;
|
|
274
|
-
export declare function
|
|
284
|
+
export declare function nanotime2ns(nanotime: bigint | null): bigint | null;
|
|
285
|
+
export declare function nanotime2str(nanotime: bigint | null, format?: string): string;
|
|
286
|
+
export declare function nanotimestamp2ns(nanotimestamp: bigint | null): bigint | null;
|
|
275
287
|
/** format nanotimestamp value (bigint) to string
|
|
276
288
|
- nanotimestamp: bigint value
|
|
277
289
|
- format?:
|
|
@@ -279,7 +291,7 @@ export declare function nanotime2str(nanotime: bigint, format?: string): string;
|
|
|
279
291
|
Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
|
|
280
292
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
281
293
|
*/
|
|
282
|
-
export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string): string;
|
|
294
|
+
export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
|
|
283
295
|
/** parse nano timestamp string to bigint value
|
|
284
296
|
- str: nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
285
297
|
- format?:
|
package/browser.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.nanotimestamp2str = exports.nanotimestamp2ns = exports.nanotime2str = exports.nanotime2ns = exports.str2timestamp = exports.datehour2str = exports.datehour2ms = exports.timestamp2str = exports.timestamp2ms = exports.datetime2str = exports.datetime2ms = exports.second2str = exports.second2ms = exports.minute2str = exports.minute2ms = exports.time2str = exports.time2ms = exports.month2str = exports.month2ms = exports.date2str = exports.date2ms = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.format = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbDurationUnit = exports.DdbFunctionType = exports.DdbType = exports.DdbForm = void 0;
|
|
4
|
+
exports.ddb = exports.DDB = exports.int1282str = exports.uuid2str = exports.ipaddr2str = exports.str2nanotimestamp = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
7
|
const customParseFormat_js_1 = tslib_1.__importDefault(require("dayjs/plugin/customParseFormat.js"));
|
|
@@ -21,6 +22,8 @@ var DdbForm;
|
|
|
21
22
|
DdbForm[DdbForm["table"] = 6] = "table";
|
|
22
23
|
DdbForm[DdbForm["chart"] = 7] = "chart";
|
|
23
24
|
DdbForm[DdbForm["chunk"] = 8] = "chunk";
|
|
25
|
+
/** sysobj */
|
|
26
|
+
DdbForm[DdbForm["object"] = 9] = "object";
|
|
24
27
|
})(DdbForm = exports.DdbForm || (exports.DdbForm = {}));
|
|
25
28
|
/** DolphinDB DataType
|
|
26
29
|
对应的 array vector 类型为 64 + 基本类型
|
|
@@ -1172,7 +1175,7 @@ function format(type, value, le) {
|
|
|
1172
1175
|
case DdbType.uuid:
|
|
1173
1176
|
return uuid2str(value, le);
|
|
1174
1177
|
case DdbType.functiondef:
|
|
1175
|
-
return value.quote('single');
|
|
1178
|
+
return value.name.quote('single');
|
|
1176
1179
|
case DdbType.handle:
|
|
1177
1180
|
case DdbType.code:
|
|
1178
1181
|
return value.quote('single');
|
|
@@ -1220,7 +1223,6 @@ class DdbVoid extends DdbObj {
|
|
|
1220
1223
|
super({
|
|
1221
1224
|
form: DdbForm.scalar,
|
|
1222
1225
|
type: DdbType.void,
|
|
1223
|
-
length: 0,
|
|
1224
1226
|
value: null,
|
|
1225
1227
|
});
|
|
1226
1228
|
}
|
|
@@ -1231,7 +1233,6 @@ class DdbBool extends DdbObj {
|
|
|
1231
1233
|
super({
|
|
1232
1234
|
form: DdbForm.scalar,
|
|
1233
1235
|
type: DdbType.bool,
|
|
1234
|
-
length: 1,
|
|
1235
1236
|
value,
|
|
1236
1237
|
});
|
|
1237
1238
|
}
|
|
@@ -1242,7 +1243,6 @@ class DdbChar extends DdbObj {
|
|
|
1242
1243
|
super({
|
|
1243
1244
|
form: DdbForm.scalar,
|
|
1244
1245
|
type: DdbType.char,
|
|
1245
|
-
length: 1,
|
|
1246
1246
|
value: typeof value === 'string' ?
|
|
1247
1247
|
value.charCodeAt(0)
|
|
1248
1248
|
:
|
|
@@ -1256,7 +1256,6 @@ class DdbInt extends DdbObj {
|
|
|
1256
1256
|
super({
|
|
1257
1257
|
form: DdbForm.scalar,
|
|
1258
1258
|
type: DdbType.int,
|
|
1259
|
-
length: 4,
|
|
1260
1259
|
value,
|
|
1261
1260
|
});
|
|
1262
1261
|
}
|
|
@@ -1267,7 +1266,6 @@ class DdbString extends DdbObj {
|
|
|
1267
1266
|
super({
|
|
1268
1267
|
form: DdbForm.scalar,
|
|
1269
1268
|
type: DdbType.string,
|
|
1270
|
-
length: 0,
|
|
1271
1269
|
value
|
|
1272
1270
|
});
|
|
1273
1271
|
}
|
|
@@ -1278,7 +1276,6 @@ class DdbLong extends DdbObj {
|
|
|
1278
1276
|
super({
|
|
1279
1277
|
form: DdbForm.scalar,
|
|
1280
1278
|
type: DdbType.long,
|
|
1281
|
-
length: 8,
|
|
1282
1279
|
value
|
|
1283
1280
|
});
|
|
1284
1281
|
}
|
|
@@ -1289,7 +1286,6 @@ class DdbDouble extends DdbObj {
|
|
|
1289
1286
|
super({
|
|
1290
1287
|
form: DdbForm.scalar,
|
|
1291
1288
|
type: DdbType.double,
|
|
1292
|
-
length: 8,
|
|
1293
1289
|
value
|
|
1294
1290
|
});
|
|
1295
1291
|
}
|
|
@@ -1300,7 +1296,6 @@ class DdbDateTime extends DdbObj {
|
|
|
1300
1296
|
super({
|
|
1301
1297
|
form: DdbForm.scalar,
|
|
1302
1298
|
type: DdbType.datetime,
|
|
1303
|
-
length: 4,
|
|
1304
1299
|
value
|
|
1305
1300
|
});
|
|
1306
1301
|
}
|
|
@@ -1311,7 +1306,6 @@ class DdbTimeStamp extends DdbObj {
|
|
|
1311
1306
|
super({
|
|
1312
1307
|
form: DdbForm.scalar,
|
|
1313
1308
|
type: DdbType.timestamp,
|
|
1314
|
-
length: 8,
|
|
1315
1309
|
value
|
|
1316
1310
|
});
|
|
1317
1311
|
}
|
|
@@ -1322,7 +1316,6 @@ class DdbNanoTimeStamp extends DdbObj {
|
|
|
1322
1316
|
super({
|
|
1323
1317
|
form: DdbForm.scalar,
|
|
1324
1318
|
type: DdbType.nanotimestamp,
|
|
1325
|
-
length: 8,
|
|
1326
1319
|
value
|
|
1327
1320
|
});
|
|
1328
1321
|
}
|
|
@@ -1333,7 +1326,6 @@ class DdbPair extends DdbObj {
|
|
|
1333
1326
|
super({
|
|
1334
1327
|
form: DdbForm.pair,
|
|
1335
1328
|
type: DdbType.int,
|
|
1336
|
-
length: 0,
|
|
1337
1329
|
rows: 2,
|
|
1338
1330
|
cols: 1,
|
|
1339
1331
|
value: Int32Array.of(l === null ? exports.nulls.int32 : l, r === null ? exports.nulls.int32 : r)
|
|
@@ -1346,7 +1338,6 @@ class DdbFunction extends DdbObj {
|
|
|
1346
1338
|
super({
|
|
1347
1339
|
form: DdbForm.scalar,
|
|
1348
1340
|
type: DdbType.functiondef,
|
|
1349
|
-
length: 0,
|
|
1350
1341
|
value: { type, name }
|
|
1351
1342
|
});
|
|
1352
1343
|
}
|
|
@@ -1357,7 +1348,6 @@ class DdbVectorInt extends DdbObj {
|
|
|
1357
1348
|
super({
|
|
1358
1349
|
form: DdbForm.vector,
|
|
1359
1350
|
type: DdbType.int,
|
|
1360
|
-
length: 0,
|
|
1361
1351
|
rows: ints.length,
|
|
1362
1352
|
cols: 1,
|
|
1363
1353
|
value: ints instanceof Int32Array ?
|
|
@@ -1377,7 +1367,6 @@ class DdbVectorDouble extends DdbObj {
|
|
|
1377
1367
|
super({
|
|
1378
1368
|
form: DdbForm.vector,
|
|
1379
1369
|
type: DdbType.double,
|
|
1380
|
-
length: 0,
|
|
1381
1370
|
rows: doubles.length,
|
|
1382
1371
|
cols: 1,
|
|
1383
1372
|
value: doubles instanceof Float64Array ?
|
|
@@ -1397,7 +1386,6 @@ class DdbVectorString extends DdbObj {
|
|
|
1397
1386
|
super({
|
|
1398
1387
|
form: DdbForm.vector,
|
|
1399
1388
|
type: DdbType.string,
|
|
1400
|
-
length: 0,
|
|
1401
1389
|
rows: strings.length,
|
|
1402
1390
|
cols: 1,
|
|
1403
1391
|
value: strings,
|
|
@@ -1411,7 +1399,6 @@ class DdbVectorAny extends DdbObj {
|
|
|
1411
1399
|
super({
|
|
1412
1400
|
form: DdbForm.vector,
|
|
1413
1401
|
type: DdbType.any,
|
|
1414
|
-
length: 0,
|
|
1415
1402
|
rows: objs.length,
|
|
1416
1403
|
cols: 1,
|
|
1417
1404
|
value: objs,
|
|
@@ -1438,7 +1425,6 @@ class DdbVectorSymbol extends DdbObj {
|
|
|
1438
1425
|
super({
|
|
1439
1426
|
form: DdbForm.vector,
|
|
1440
1427
|
type: DdbType.symbol_extended,
|
|
1441
|
-
length: 0,
|
|
1442
1428
|
rows: strings.length,
|
|
1443
1429
|
cols: 1,
|
|
1444
1430
|
value: {
|
|
@@ -1456,7 +1442,6 @@ class DdbSetInt extends DdbObj {
|
|
|
1456
1442
|
super({
|
|
1457
1443
|
form: DdbForm.set,
|
|
1458
1444
|
type: DdbType.int,
|
|
1459
|
-
length: 0,
|
|
1460
1445
|
rows: ints instanceof Set ?
|
|
1461
1446
|
ints.size
|
|
1462
1447
|
:
|
|
@@ -1478,7 +1463,6 @@ class DdbSetDouble extends DdbObj {
|
|
|
1478
1463
|
super({
|
|
1479
1464
|
form: DdbForm.set,
|
|
1480
1465
|
type: DdbType.double,
|
|
1481
|
-
length: 0,
|
|
1482
1466
|
rows: doubles instanceof Set ?
|
|
1483
1467
|
doubles.size
|
|
1484
1468
|
:
|
|
@@ -1502,7 +1486,6 @@ class DdbSetString extends DdbObj {
|
|
|
1502
1486
|
super({
|
|
1503
1487
|
form: DdbForm.set,
|
|
1504
1488
|
type: DdbType.string,
|
|
1505
|
-
length: 0,
|
|
1506
1489
|
rows: strings.length,
|
|
1507
1490
|
cols: 1,
|
|
1508
1491
|
value: strings
|
|
@@ -1515,7 +1498,6 @@ class DdbTable extends DdbObj {
|
|
|
1515
1498
|
super({
|
|
1516
1499
|
form: DdbForm.table,
|
|
1517
1500
|
type: DdbType.void,
|
|
1518
|
-
length: 0,
|
|
1519
1501
|
rows: columns[0].rows,
|
|
1520
1502
|
cols: columns.length,
|
|
1521
1503
|
name,
|
|
@@ -1524,13 +1506,27 @@ class DdbTable extends DdbObj {
|
|
|
1524
1506
|
}
|
|
1525
1507
|
}
|
|
1526
1508
|
exports.DdbTable = DdbTable;
|
|
1509
|
+
function date2ms(date) {
|
|
1510
|
+
return (date === null || date === exports.nulls.int32) ?
|
|
1511
|
+
null
|
|
1512
|
+
:
|
|
1513
|
+
exports.timezone_offset + 1000 * 3600 * 24 * date;
|
|
1514
|
+
}
|
|
1515
|
+
exports.date2ms = date2ms;
|
|
1527
1516
|
function date2str(date, format = 'YYYY.MM.DD') {
|
|
1528
1517
|
return (date === null || date === exports.nulls.int32) ?
|
|
1529
|
-
|
|
1518
|
+
null
|
|
1530
1519
|
:
|
|
1531
|
-
(0, dayjs_1.default)(
|
|
1520
|
+
(0, dayjs_1.default)(date2ms(date)).format(format);
|
|
1532
1521
|
}
|
|
1533
1522
|
exports.date2str = date2str;
|
|
1523
|
+
function month2ms(month) {
|
|
1524
|
+
return (month === null || month === exports.nulls.int32) ?
|
|
1525
|
+
null
|
|
1526
|
+
:
|
|
1527
|
+
(0, dayjs_1.default)(month2str(month), 'YYYY.MM[M]').valueOf();
|
|
1528
|
+
}
|
|
1529
|
+
exports.month2ms = month2ms;
|
|
1534
1530
|
function month2str(month) {
|
|
1535
1531
|
if (month === null || month === exports.nulls.int32)
|
|
1536
1532
|
return 'null';
|
|
@@ -1541,37 +1537,69 @@ function month2str(month) {
|
|
|
1541
1537
|
return `${String(year).padStart(4, '0')}.${String(_month + 1).padStart(2, '0')}M`;
|
|
1542
1538
|
}
|
|
1543
1539
|
exports.month2str = month2str;
|
|
1540
|
+
function time2ms(time) {
|
|
1541
|
+
return (time === null || time === exports.nulls.int32) ?
|
|
1542
|
+
null
|
|
1543
|
+
:
|
|
1544
|
+
exports.timezone_offset + time;
|
|
1545
|
+
}
|
|
1546
|
+
exports.time2ms = time2ms;
|
|
1544
1547
|
function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
1545
1548
|
return (time === null || time === exports.nulls.int32) ?
|
|
1546
|
-
|
|
1549
|
+
null
|
|
1547
1550
|
:
|
|
1548
|
-
(0, dayjs_1.default)(
|
|
1549
|
-
.format(format);
|
|
1551
|
+
(0, dayjs_1.default)(time2ms(time)).format(format);
|
|
1550
1552
|
}
|
|
1551
1553
|
exports.time2str = time2str;
|
|
1554
|
+
function minute2ms(minute) {
|
|
1555
|
+
return (minute === null || minute === exports.nulls.int32) ?
|
|
1556
|
+
null
|
|
1557
|
+
:
|
|
1558
|
+
exports.timezone_offset + 60 * 1000 * minute;
|
|
1559
|
+
}
|
|
1560
|
+
exports.minute2ms = minute2ms;
|
|
1552
1561
|
function minute2str(minute, format = 'HH:mm[m]') {
|
|
1553
1562
|
return (minute === null || minute === exports.nulls.int32) ?
|
|
1554
1563
|
'null'
|
|
1555
1564
|
:
|
|
1556
|
-
(0, dayjs_1.default)(
|
|
1557
|
-
.format(format);
|
|
1565
|
+
(0, dayjs_1.default)(minute2ms(minute)).format(format);
|
|
1558
1566
|
}
|
|
1559
1567
|
exports.minute2str = minute2str;
|
|
1568
|
+
function second2ms(second) {
|
|
1569
|
+
return (second === null || second === exports.nulls.int32) ?
|
|
1570
|
+
null
|
|
1571
|
+
:
|
|
1572
|
+
exports.timezone_offset + 1000 * second;
|
|
1573
|
+
}
|
|
1574
|
+
exports.second2ms = second2ms;
|
|
1560
1575
|
function second2str(second, format = 'HH:mm:ss') {
|
|
1561
1576
|
return (second === null || second === exports.nulls.int32) ?
|
|
1562
1577
|
'null'
|
|
1563
1578
|
:
|
|
1564
|
-
(0, dayjs_1.default)(
|
|
1565
|
-
.format(format);
|
|
1579
|
+
(0, dayjs_1.default)(second2ms(second)).format(format);
|
|
1566
1580
|
}
|
|
1567
1581
|
exports.second2str = second2str;
|
|
1582
|
+
function datetime2ms(datetime) {
|
|
1583
|
+
return (datetime === null || datetime === exports.nulls.int32) ?
|
|
1584
|
+
null
|
|
1585
|
+
:
|
|
1586
|
+
exports.timezone_offset + 1000 * datetime;
|
|
1587
|
+
}
|
|
1588
|
+
exports.datetime2ms = datetime2ms;
|
|
1568
1589
|
function datetime2str(datetime, format = 'YYYY.MM.DD HH:mm:ss') {
|
|
1569
1590
|
return (datetime === null || datetime === exports.nulls.int32) ?
|
|
1570
1591
|
'null'
|
|
1571
1592
|
:
|
|
1572
|
-
(0, dayjs_1.default)(
|
|
1593
|
+
(0, dayjs_1.default)(datetime2ms(datetime)).format(format);
|
|
1573
1594
|
}
|
|
1574
1595
|
exports.datetime2str = datetime2str;
|
|
1596
|
+
function timestamp2ms(timestamp) {
|
|
1597
|
+
return (timestamp === null || timestamp === exports.nulls.int64) ?
|
|
1598
|
+
null
|
|
1599
|
+
:
|
|
1600
|
+
exports.timezone_offset + Number(timestamp);
|
|
1601
|
+
}
|
|
1602
|
+
exports.timestamp2ms = timestamp2ms;
|
|
1575
1603
|
/** format timestamp (bigint) to string
|
|
1576
1604
|
- timestamp: bigint value
|
|
1577
1605
|
- format?:
|
|
@@ -1582,9 +1610,16 @@ function timestamp2str(timestamp, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1582
1610
|
return (timestamp === null || timestamp === exports.nulls.int64) ?
|
|
1583
1611
|
'null'
|
|
1584
1612
|
:
|
|
1585
|
-
(0, dayjs_1.default)(
|
|
1613
|
+
(0, dayjs_1.default)(timestamp2ms(timestamp)).format(format);
|
|
1586
1614
|
}
|
|
1587
1615
|
exports.timestamp2str = timestamp2str;
|
|
1616
|
+
function datehour2ms(datehour) {
|
|
1617
|
+
return (datehour === null || datehour === exports.nulls.int32) ?
|
|
1618
|
+
null
|
|
1619
|
+
:
|
|
1620
|
+
exports.timezone_offset + 1000 * 3600 * datehour;
|
|
1621
|
+
}
|
|
1622
|
+
exports.datehour2ms = datehour2ms;
|
|
1588
1623
|
function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
1589
1624
|
return (datehour === null || datehour === exports.nulls.int32) ?
|
|
1590
1625
|
'null'
|
|
@@ -1607,6 +1642,10 @@ function str2timestamp(str, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1607
1642
|
(0, dayjs_1.default)(str, format).valueOf());
|
|
1608
1643
|
}
|
|
1609
1644
|
exports.str2timestamp = str2timestamp;
|
|
1645
|
+
function nanotime2ns(nanotime) {
|
|
1646
|
+
return nanotimestamp2ns(nanotime);
|
|
1647
|
+
}
|
|
1648
|
+
exports.nanotime2ns = nanotime2ns;
|
|
1610
1649
|
function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
1611
1650
|
if (nanotime === null || nanotime === exports.nulls.int64)
|
|
1612
1651
|
return 'null';
|
|
@@ -1624,6 +1663,13 @@ function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
1624
1663
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
1625
1664
|
}
|
|
1626
1665
|
exports.nanotime2str = nanotime2str;
|
|
1666
|
+
function nanotimestamp2ns(nanotimestamp) {
|
|
1667
|
+
return (nanotimestamp === null || nanotimestamp === exports.nulls.int64) ?
|
|
1668
|
+
null
|
|
1669
|
+
:
|
|
1670
|
+
BigInt(exports.timezone_offset) * 1000000n + nanotimestamp;
|
|
1671
|
+
}
|
|
1672
|
+
exports.nanotimestamp2ns = nanotimestamp2ns;
|
|
1627
1673
|
/** format nanotimestamp value (bigint) to string
|
|
1628
1674
|
- nanotimestamp: bigint value
|
|
1629
1675
|
- format?:
|