dolphindb 3.0.106 → 3.0.107
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 +4 -4
- package/browser.js +12 -12
- package/browser.js.map +1 -1
- package/i18n/dict.json +3 -0
- package/index.d.ts +2 -2
- package/index.js +9 -9
- package/index.js.map +1 -1
- package/package.json +2 -2
package/i18n/dict.json
CHANGED
|
@@ -91,5 +91,8 @@
|
|
|
91
91
|
},
|
|
92
92
|
"pack 时字符串中间不能含有 \\0, 否则上传给 DolphinDB 会导致连接断开": {
|
|
93
93
|
"en": "The string cannot contain \\0 in the middle when packing, otherwise uploading to DolphinDB will cause the connection to be disconnected"
|
|
94
|
+
},
|
|
95
|
+
"发送至 DolphinDB 执行的脚本中间不能含有 \\0": {
|
|
96
|
+
"en": "The script sent to DolphinDB for execution cannot contain \\0 in the middle"
|
|
94
97
|
}
|
|
95
98
|
}
|
package/index.d.ts
CHANGED
|
@@ -400,7 +400,7 @@ export interface ConvertOptions {
|
|
|
400
400
|
/** timestamp 类型转换为字符串表示时显示到秒还是毫秒 */
|
|
401
401
|
timestamp?: 's' | 'ms';
|
|
402
402
|
}
|
|
403
|
-
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] |
|
|
403
|
+
export declare function convert(type: DdbType, value: DdbValue, le: boolean, { blob, timestamp }?: ConvertOptions): string | number | bigint | boolean | Uint8Array | number[] | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | string[] | Uint8Array[] | DdbFunctionDefValue | DdbDurationValue | DdbDecimal32Value | DdbDecimal64Value | BigInt128Array | DdbObj<DdbValue>[] | DdbSymbolExtendedValue | DdbArrayVectorValue | DdbDecimal32VectorValue | DdbDecimal64VectorValue | DdbDecimal128VectorValue | DdbDurationVectorValue | DdbMatrixValue | DdbChartValue | DdbTensorValue;
|
|
404
404
|
/** 转换一个向量到 js 原生数组 */
|
|
405
405
|
export declare function converts(type: DdbType, value: DdbVectorValue, rows: number, le: boolean, options?: ConvertOptions): any[];
|
|
406
406
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
@@ -494,7 +494,7 @@ export declare function second2str(second: number | null, format?: string): stri
|
|
|
494
494
|
export declare function datetime2ms(datetime: number | null): number | null;
|
|
495
495
|
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
496
496
|
/** _datetime_formatter.format 会在 date 为 Invalid Date 时抛出错误 */
|
|
497
|
-
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
497
|
+
export declare function timestamp2ms(timestamp: bigint | number | null): number | null;
|
|
498
498
|
/** format timestamp (bigint) to string
|
|
499
499
|
- timestamp: bigint value
|
|
500
500
|
- format?:
|
package/index.js
CHANGED
|
@@ -2409,13 +2409,13 @@ export class DdbTable extends DdbObj {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
export function date2ms(date) {
|
|
2412
|
-
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点)
|
|
2413
|
-
// 本地的时区与实际的时间值相关,
|
|
2412
|
+
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点) 作为 UTC-0 格式化为字符串,然后根据本地的时区解析这个字符串转换为 UTC-8
|
|
2413
|
+
// 本地的时区与实际的时间值相关,getTimezoneOffset() 可能会受到夏令时 (DST) 的影响,不能使用
|
|
2414
2414
|
// 得到的 utc 毫秒数交给 js date 或者 dayjs 去格式化
|
|
2415
2415
|
if (date === null || date === nulls.int32)
|
|
2416
2416
|
return null;
|
|
2417
2417
|
const ms = 1000 * 3600 * 24 * date;
|
|
2418
|
-
return
|
|
2418
|
+
return timestamp2ms(ms);
|
|
2419
2419
|
}
|
|
2420
2420
|
export function date2str(date, format = 'YYYY.MM.DD') {
|
|
2421
2421
|
return (date === null || date === nulls.int32) ?
|
|
@@ -2442,7 +2442,7 @@ export function time2ms(time) {
|
|
|
2442
2442
|
return (time === null || time === nulls.int32) ?
|
|
2443
2443
|
null
|
|
2444
2444
|
:
|
|
2445
|
-
|
|
2445
|
+
timestamp2ms(time);
|
|
2446
2446
|
}
|
|
2447
2447
|
export function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
2448
2448
|
return (time === null || time === nulls.int32) ?
|
|
@@ -2454,7 +2454,7 @@ export function minute2ms(minute) {
|
|
|
2454
2454
|
if (minute === null || minute === nulls.int32)
|
|
2455
2455
|
return null;
|
|
2456
2456
|
const ms = 60 * 1000 * minute;
|
|
2457
|
-
return
|
|
2457
|
+
return timestamp2ms(ms);
|
|
2458
2458
|
}
|
|
2459
2459
|
export function minute2str(minute, format = 'HH:mm[m]') {
|
|
2460
2460
|
return (minute === null || minute === nulls.int32) ?
|
|
@@ -2466,7 +2466,7 @@ export function second2ms(second) {
|
|
|
2466
2466
|
if (second === null || second === nulls.int32)
|
|
2467
2467
|
return null;
|
|
2468
2468
|
const ms = 1000 * second;
|
|
2469
|
-
return
|
|
2469
|
+
return timestamp2ms(ms);
|
|
2470
2470
|
}
|
|
2471
2471
|
export function second2str(second, format = 'HH:mm:ss') {
|
|
2472
2472
|
return (second === null || second === nulls.int32) ?
|
|
@@ -2508,13 +2508,13 @@ export function datehour2ms(datehour) {
|
|
|
2508
2508
|
if (datehour === null || datehour === nulls.int32)
|
|
2509
2509
|
return null;
|
|
2510
2510
|
const ms = 1000 * 3600 * datehour;
|
|
2511
|
-
return
|
|
2511
|
+
return timestamp2ms(ms);
|
|
2512
2512
|
}
|
|
2513
2513
|
export function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
2514
2514
|
if (datehour === null || datehour === nulls.int32)
|
|
2515
2515
|
return 'null';
|
|
2516
2516
|
const ms = 1000 * 3600 * datehour;
|
|
2517
|
-
return dayjs(
|
|
2517
|
+
return dayjs(timestamp2ms(ms)).format(format);
|
|
2518
2518
|
}
|
|
2519
2519
|
/** parse timestamp string to bigint value
|
|
2520
2520
|
- str: timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
|
|
@@ -2545,7 +2545,7 @@ export function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
2545
2545
|
const i_nanosecond_start = format.indexOf('SSSSSSSSS', i_second_end);
|
|
2546
2546
|
assert(i_nanosecond_start !== -1, t('格式串必须包含纳秒的格式 (SSSSSSSSS)'));
|
|
2547
2547
|
const ms = Number(nanotime) / 1000000;
|
|
2548
|
-
return (dayjs(
|
|
2548
|
+
return (dayjs(timestamp2ms(ms)).format(format.slice(0, i_second_end)) +
|
|
2549
2549
|
format.slice(i_second_end, i_nanosecond_start) +
|
|
2550
2550
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
2551
2551
|
}
|