dolphindb 2.0.519 → 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 +17 -7
- package/browser.js +77 -12
- package/browser.js.map +1 -1
- package/index.d.ts +17 -7
- package/index.js +77 -12
- package/index.js.map +1 -1
- package/package.json +4 -2
package/browser.d.ts
CHANGED
|
@@ -252,20 +252,28 @@ export declare class DdbSetString extends DdbObj<string[]> {
|
|
|
252
252
|
export declare class DdbTable extends DdbObj<DdbObj[]> {
|
|
253
253
|
constructor(columns: DdbObj[], name?: string);
|
|
254
254
|
}
|
|
255
|
-
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;
|
|
256
258
|
export declare function month2str(month: number | null): string;
|
|
257
|
-
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;
|
|
258
262
|
export declare function minute2str(minute: number | null, format?: string): string;
|
|
263
|
+
export declare function second2ms(second: number | null): number | null;
|
|
259
264
|
export declare function second2str(second: number | null, format?: string): string;
|
|
260
|
-
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;
|
|
261
268
|
/** format timestamp (bigint) to string
|
|
262
269
|
- timestamp: bigint value
|
|
263
270
|
- format?:
|
|
264
271
|
format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
|
|
265
272
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
266
273
|
*/
|
|
267
|
-
export declare function timestamp2str(timestamp: bigint, format?: string): string;
|
|
268
|
-
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;
|
|
269
277
|
/** parse timestamp string to bigint value
|
|
270
278
|
- str: timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
271
279
|
- format?:
|
|
@@ -273,7 +281,9 @@ export declare function datehour2str(datehour: number, format?: string): string;
|
|
|
273
281
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
274
282
|
*/
|
|
275
283
|
export declare function str2timestamp(str: string, format?: string): bigint;
|
|
276
|
-
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;
|
|
277
287
|
/** format nanotimestamp value (bigint) to string
|
|
278
288
|
- nanotimestamp: bigint value
|
|
279
289
|
- format?:
|
|
@@ -281,7 +291,7 @@ export declare function nanotime2str(nanotime: bigint, format?: string): string;
|
|
|
281
291
|
Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
|
|
282
292
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
283
293
|
*/
|
|
284
|
-
export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string): string;
|
|
294
|
+
export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
|
|
285
295
|
/** parse nano timestamp string to bigint value
|
|
286
296
|
- str: nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
287
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"));
|
|
@@ -1505,13 +1506,27 @@ class DdbTable extends DdbObj {
|
|
|
1505
1506
|
}
|
|
1506
1507
|
}
|
|
1507
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;
|
|
1508
1516
|
function date2str(date, format = 'YYYY.MM.DD') {
|
|
1509
1517
|
return (date === null || date === exports.nulls.int32) ?
|
|
1510
|
-
|
|
1518
|
+
null
|
|
1511
1519
|
:
|
|
1512
|
-
(0, dayjs_1.default)(
|
|
1520
|
+
(0, dayjs_1.default)(date2ms(date)).format(format);
|
|
1513
1521
|
}
|
|
1514
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;
|
|
1515
1530
|
function month2str(month) {
|
|
1516
1531
|
if (month === null || month === exports.nulls.int32)
|
|
1517
1532
|
return 'null';
|
|
@@ -1522,37 +1537,69 @@ function month2str(month) {
|
|
|
1522
1537
|
return `${String(year).padStart(4, '0')}.${String(_month + 1).padStart(2, '0')}M`;
|
|
1523
1538
|
}
|
|
1524
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;
|
|
1525
1547
|
function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
1526
1548
|
return (time === null || time === exports.nulls.int32) ?
|
|
1527
|
-
|
|
1549
|
+
null
|
|
1528
1550
|
:
|
|
1529
|
-
(0, dayjs_1.default)(
|
|
1530
|
-
.format(format);
|
|
1551
|
+
(0, dayjs_1.default)(time2ms(time)).format(format);
|
|
1531
1552
|
}
|
|
1532
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;
|
|
1533
1561
|
function minute2str(minute, format = 'HH:mm[m]') {
|
|
1534
1562
|
return (minute === null || minute === exports.nulls.int32) ?
|
|
1535
1563
|
'null'
|
|
1536
1564
|
:
|
|
1537
|
-
(0, dayjs_1.default)(
|
|
1538
|
-
.format(format);
|
|
1565
|
+
(0, dayjs_1.default)(minute2ms(minute)).format(format);
|
|
1539
1566
|
}
|
|
1540
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;
|
|
1541
1575
|
function second2str(second, format = 'HH:mm:ss') {
|
|
1542
1576
|
return (second === null || second === exports.nulls.int32) ?
|
|
1543
1577
|
'null'
|
|
1544
1578
|
:
|
|
1545
|
-
(0, dayjs_1.default)(
|
|
1546
|
-
.format(format);
|
|
1579
|
+
(0, dayjs_1.default)(second2ms(second)).format(format);
|
|
1547
1580
|
}
|
|
1548
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;
|
|
1549
1589
|
function datetime2str(datetime, format = 'YYYY.MM.DD HH:mm:ss') {
|
|
1550
1590
|
return (datetime === null || datetime === exports.nulls.int32) ?
|
|
1551
1591
|
'null'
|
|
1552
1592
|
:
|
|
1553
|
-
(0, dayjs_1.default)(
|
|
1593
|
+
(0, dayjs_1.default)(datetime2ms(datetime)).format(format);
|
|
1554
1594
|
}
|
|
1555
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;
|
|
1556
1603
|
/** format timestamp (bigint) to string
|
|
1557
1604
|
- timestamp: bigint value
|
|
1558
1605
|
- format?:
|
|
@@ -1563,9 +1610,16 @@ function timestamp2str(timestamp, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1563
1610
|
return (timestamp === null || timestamp === exports.nulls.int64) ?
|
|
1564
1611
|
'null'
|
|
1565
1612
|
:
|
|
1566
|
-
(0, dayjs_1.default)(
|
|
1613
|
+
(0, dayjs_1.default)(timestamp2ms(timestamp)).format(format);
|
|
1567
1614
|
}
|
|
1568
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;
|
|
1569
1623
|
function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
1570
1624
|
return (datehour === null || datehour === exports.nulls.int32) ?
|
|
1571
1625
|
'null'
|
|
@@ -1588,6 +1642,10 @@ function str2timestamp(str, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1588
1642
|
(0, dayjs_1.default)(str, format).valueOf());
|
|
1589
1643
|
}
|
|
1590
1644
|
exports.str2timestamp = str2timestamp;
|
|
1645
|
+
function nanotime2ns(nanotime) {
|
|
1646
|
+
return nanotimestamp2ns(nanotime);
|
|
1647
|
+
}
|
|
1648
|
+
exports.nanotime2ns = nanotime2ns;
|
|
1591
1649
|
function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
1592
1650
|
if (nanotime === null || nanotime === exports.nulls.int64)
|
|
1593
1651
|
return 'null';
|
|
@@ -1605,6 +1663,13 @@ function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
1605
1663
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
1606
1664
|
}
|
|
1607
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;
|
|
1608
1673
|
/** format nanotimestamp value (bigint) to string
|
|
1609
1674
|
- nanotimestamp: bigint value
|
|
1610
1675
|
- format?:
|