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/index.d.ts
CHANGED
|
@@ -249,20 +249,28 @@ export declare class DdbSetString extends DdbObj<string[]> {
|
|
|
249
249
|
export declare class DdbTable extends DdbObj<DdbObj[]> {
|
|
250
250
|
constructor(columns: DdbObj[], name?: string);
|
|
251
251
|
}
|
|
252
|
-
export declare function
|
|
252
|
+
export declare function date2ms(date: number | null): number;
|
|
253
|
+
export declare function date2str(date: number | null, format?: string): string;
|
|
254
|
+
export declare function month2ms(month: number | null): number | null;
|
|
253
255
|
export declare function month2str(month: number | null): string;
|
|
254
|
-
export declare function
|
|
256
|
+
export declare function time2ms(time: number | null): number | null;
|
|
257
|
+
export declare function time2str(time: number | null, format?: string): string;
|
|
258
|
+
export declare function minute2ms(minute: number | null): number | null;
|
|
255
259
|
export declare function minute2str(minute: number | null, format?: string): string;
|
|
260
|
+
export declare function second2ms(second: number | null): number | null;
|
|
256
261
|
export declare function second2str(second: number | null, format?: string): string;
|
|
257
|
-
export declare function
|
|
262
|
+
export declare function datetime2ms(datetime: number | null): number | null;
|
|
263
|
+
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
264
|
+
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
258
265
|
/** format timestamp (bigint) to string
|
|
259
266
|
- timestamp: bigint value
|
|
260
267
|
- format?:
|
|
261
268
|
format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
|
|
262
269
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
263
270
|
*/
|
|
264
|
-
export declare function timestamp2str(timestamp: bigint, format?: string): string;
|
|
265
|
-
export declare function
|
|
271
|
+
export declare function timestamp2str(timestamp: bigint | null, format?: string): string;
|
|
272
|
+
export declare function datehour2ms(datehour: number | null): number | null;
|
|
273
|
+
export declare function datehour2str(datehour: number | null, format?: string): string;
|
|
266
274
|
/** parse timestamp string to bigint value
|
|
267
275
|
- str: timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
268
276
|
- format?:
|
|
@@ -270,7 +278,9 @@ export declare function datehour2str(datehour: number, format?: string): string;
|
|
|
270
278
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
271
279
|
*/
|
|
272
280
|
export declare function str2timestamp(str: string, format?: string): bigint;
|
|
273
|
-
export declare function
|
|
281
|
+
export declare function nanotime2ns(nanotime: bigint | null): bigint | null;
|
|
282
|
+
export declare function nanotime2str(nanotime: bigint | null, format?: string): string;
|
|
283
|
+
export declare function nanotimestamp2ns(nanotimestamp: bigint | null): bigint | null;
|
|
274
284
|
/** format nanotimestamp value (bigint) to string
|
|
275
285
|
- nanotimestamp: bigint value
|
|
276
286
|
- format?:
|
|
@@ -278,7 +288,7 @@ export declare function nanotime2str(nanotime: bigint, format?: string): string;
|
|
|
278
288
|
Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
|
|
279
289
|
https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
|
|
280
290
|
*/
|
|
281
|
-
export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string): string;
|
|
291
|
+
export declare function nanotimestamp2str(nanotimestamp: bigint | null, format?: string): string;
|
|
282
292
|
/** parse nano timestamp string to bigint value
|
|
283
293
|
- str: nano timestamp string, If it is an empty string or 'null', it will return the corresponding empty value (nulls.int64)
|
|
284
294
|
- format?:
|
package/index.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.int1282str = exports.uuid2str = exports.ipaddr2str = exports.str2nanotimestamp = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const ws_1 = require("ws");
|
|
6
7
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
@@ -1536,13 +1537,27 @@ class DdbTable extends DdbObj {
|
|
|
1536
1537
|
}
|
|
1537
1538
|
}
|
|
1538
1539
|
exports.DdbTable = DdbTable;
|
|
1540
|
+
function date2ms(date) {
|
|
1541
|
+
return (date === null || date === exports.nulls.int32) ?
|
|
1542
|
+
null
|
|
1543
|
+
:
|
|
1544
|
+
exports.timezone_offset + 1000 * 3600 * 24 * date;
|
|
1545
|
+
}
|
|
1546
|
+
exports.date2ms = date2ms;
|
|
1539
1547
|
function date2str(date, format = 'YYYY.MM.DD') {
|
|
1540
1548
|
return (date === null || date === exports.nulls.int32) ?
|
|
1541
|
-
|
|
1549
|
+
null
|
|
1542
1550
|
:
|
|
1543
|
-
(0, dayjs_1.default)(
|
|
1551
|
+
(0, dayjs_1.default)(date2ms(date)).format(format);
|
|
1544
1552
|
}
|
|
1545
1553
|
exports.date2str = date2str;
|
|
1554
|
+
function month2ms(month) {
|
|
1555
|
+
return (month === null || month === exports.nulls.int32) ?
|
|
1556
|
+
null
|
|
1557
|
+
:
|
|
1558
|
+
(0, dayjs_1.default)(month2str(month), 'YYYY.MM[M]').valueOf();
|
|
1559
|
+
}
|
|
1560
|
+
exports.month2ms = month2ms;
|
|
1546
1561
|
function month2str(month) {
|
|
1547
1562
|
if (month === null || month === exports.nulls.int32)
|
|
1548
1563
|
return 'null';
|
|
@@ -1553,37 +1568,69 @@ function month2str(month) {
|
|
|
1553
1568
|
return `${String(year).padStart(4, '0')}.${String(_month + 1).padStart(2, '0')}M`;
|
|
1554
1569
|
}
|
|
1555
1570
|
exports.month2str = month2str;
|
|
1571
|
+
function time2ms(time) {
|
|
1572
|
+
return (time === null || time === exports.nulls.int32) ?
|
|
1573
|
+
null
|
|
1574
|
+
:
|
|
1575
|
+
exports.timezone_offset + time;
|
|
1576
|
+
}
|
|
1577
|
+
exports.time2ms = time2ms;
|
|
1556
1578
|
function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
1557
1579
|
return (time === null || time === exports.nulls.int32) ?
|
|
1558
|
-
|
|
1580
|
+
null
|
|
1559
1581
|
:
|
|
1560
|
-
(0, dayjs_1.default)(
|
|
1561
|
-
.format(format);
|
|
1582
|
+
(0, dayjs_1.default)(time2ms(time)).format(format);
|
|
1562
1583
|
}
|
|
1563
1584
|
exports.time2str = time2str;
|
|
1585
|
+
function minute2ms(minute) {
|
|
1586
|
+
return (minute === null || minute === exports.nulls.int32) ?
|
|
1587
|
+
null
|
|
1588
|
+
:
|
|
1589
|
+
exports.timezone_offset + 60 * 1000 * minute;
|
|
1590
|
+
}
|
|
1591
|
+
exports.minute2ms = minute2ms;
|
|
1564
1592
|
function minute2str(minute, format = 'HH:mm[m]') {
|
|
1565
1593
|
return (minute === null || minute === exports.nulls.int32) ?
|
|
1566
1594
|
'null'
|
|
1567
1595
|
:
|
|
1568
|
-
(0, dayjs_1.default)(
|
|
1569
|
-
.format(format);
|
|
1596
|
+
(0, dayjs_1.default)(minute2ms(minute)).format(format);
|
|
1570
1597
|
}
|
|
1571
1598
|
exports.minute2str = minute2str;
|
|
1599
|
+
function second2ms(second) {
|
|
1600
|
+
return (second === null || second === exports.nulls.int32) ?
|
|
1601
|
+
null
|
|
1602
|
+
:
|
|
1603
|
+
exports.timezone_offset + 1000 * second;
|
|
1604
|
+
}
|
|
1605
|
+
exports.second2ms = second2ms;
|
|
1572
1606
|
function second2str(second, format = 'HH:mm:ss') {
|
|
1573
1607
|
return (second === null || second === exports.nulls.int32) ?
|
|
1574
1608
|
'null'
|
|
1575
1609
|
:
|
|
1576
|
-
(0, dayjs_1.default)(
|
|
1577
|
-
.format(format);
|
|
1610
|
+
(0, dayjs_1.default)(second2ms(second)).format(format);
|
|
1578
1611
|
}
|
|
1579
1612
|
exports.second2str = second2str;
|
|
1613
|
+
function datetime2ms(datetime) {
|
|
1614
|
+
return (datetime === null || datetime === exports.nulls.int32) ?
|
|
1615
|
+
null
|
|
1616
|
+
:
|
|
1617
|
+
exports.timezone_offset + 1000 * datetime;
|
|
1618
|
+
}
|
|
1619
|
+
exports.datetime2ms = datetime2ms;
|
|
1580
1620
|
function datetime2str(datetime, format = 'YYYY.MM.DD HH:mm:ss') {
|
|
1581
1621
|
return (datetime === null || datetime === exports.nulls.int32) ?
|
|
1582
1622
|
'null'
|
|
1583
1623
|
:
|
|
1584
|
-
(0, dayjs_1.default)(
|
|
1624
|
+
(0, dayjs_1.default)(datetime2ms(datetime)).format(format);
|
|
1585
1625
|
}
|
|
1586
1626
|
exports.datetime2str = datetime2str;
|
|
1627
|
+
function timestamp2ms(timestamp) {
|
|
1628
|
+
return (timestamp === null || timestamp === exports.nulls.int64) ?
|
|
1629
|
+
null
|
|
1630
|
+
:
|
|
1631
|
+
exports.timezone_offset + Number(timestamp);
|
|
1632
|
+
}
|
|
1633
|
+
exports.timestamp2ms = timestamp2ms;
|
|
1587
1634
|
/** format timestamp (bigint) to string
|
|
1588
1635
|
- timestamp: bigint value
|
|
1589
1636
|
- format?:
|
|
@@ -1594,9 +1641,16 @@ function timestamp2str(timestamp, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1594
1641
|
return (timestamp === null || timestamp === exports.nulls.int64) ?
|
|
1595
1642
|
'null'
|
|
1596
1643
|
:
|
|
1597
|
-
(0, dayjs_1.default)(
|
|
1644
|
+
(0, dayjs_1.default)(timestamp2ms(timestamp)).format(format);
|
|
1598
1645
|
}
|
|
1599
1646
|
exports.timestamp2str = timestamp2str;
|
|
1647
|
+
function datehour2ms(datehour) {
|
|
1648
|
+
return (datehour === null || datehour === exports.nulls.int32) ?
|
|
1649
|
+
null
|
|
1650
|
+
:
|
|
1651
|
+
exports.timezone_offset + 1000 * 3600 * datehour;
|
|
1652
|
+
}
|
|
1653
|
+
exports.datehour2ms = datehour2ms;
|
|
1600
1654
|
function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
1601
1655
|
return (datehour === null || datehour === exports.nulls.int32) ?
|
|
1602
1656
|
'null'
|
|
@@ -1619,6 +1673,10 @@ function str2timestamp(str, format = 'YYYY.MM.DD HH:mm:ss.SSS') {
|
|
|
1619
1673
|
(0, dayjs_1.default)(str, format).valueOf());
|
|
1620
1674
|
}
|
|
1621
1675
|
exports.str2timestamp = str2timestamp;
|
|
1676
|
+
function nanotime2ns(nanotime) {
|
|
1677
|
+
return nanotimestamp2ns(nanotime);
|
|
1678
|
+
}
|
|
1679
|
+
exports.nanotime2ns = nanotime2ns;
|
|
1622
1680
|
function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
1623
1681
|
if (nanotime === null || nanotime === exports.nulls.int64)
|
|
1624
1682
|
return 'null';
|
|
@@ -1636,6 +1694,13 @@ function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
1636
1694
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
1637
1695
|
}
|
|
1638
1696
|
exports.nanotime2str = nanotime2str;
|
|
1697
|
+
function nanotimestamp2ns(nanotimestamp) {
|
|
1698
|
+
return (nanotimestamp === null || nanotimestamp === exports.nulls.int64) ?
|
|
1699
|
+
null
|
|
1700
|
+
:
|
|
1701
|
+
BigInt(exports.timezone_offset) * 1000000n + nanotimestamp;
|
|
1702
|
+
}
|
|
1703
|
+
exports.nanotimestamp2ns = nanotimestamp2ns;
|
|
1639
1704
|
/** format nanotimestamp value (bigint) to string
|
|
1640
1705
|
- nanotimestamp: bigint value
|
|
1641
1706
|
- format?:
|