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/browser.d.ts
CHANGED
|
@@ -339,9 +339,9 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
|
339
339
|
data<TResult extends any[]>(this: DdbVectorObj, options?: ConvertOptions): TResult;
|
|
340
340
|
data<TResult = any>(this: DdbObj, options?: ConvertOptions): TResult;
|
|
341
341
|
/** 构建 Tensor
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
342
|
+
@param buildParams 构建参数
|
|
343
|
+
@param limit 限制每个维度最大元素个数(仅用于 log,不作他用)
|
|
344
|
+
@returns */
|
|
345
345
|
static parse_tensor(buildParams: {
|
|
346
346
|
currentDim: number;
|
|
347
347
|
dimensions: number;
|
|
@@ -505,7 +505,7 @@ export declare function second2str(second: number | null, format?: string): stri
|
|
|
505
505
|
export declare function datetime2ms(datetime: number | null): number | null;
|
|
506
506
|
export declare function datetime2str(datetime: number | null, format?: string): string;
|
|
507
507
|
/** _datetime_formatter.format 会在 date 为 Invalid Date 时抛出错误 */
|
|
508
|
-
export declare function timestamp2ms(timestamp: bigint | null): number | null;
|
|
508
|
+
export declare function timestamp2ms(timestamp: bigint | number | null): number | null;
|
|
509
509
|
/** format timestamp (bigint) to string
|
|
510
510
|
- timestamp: bigint value
|
|
511
511
|
- format?:
|
package/browser.js
CHANGED
|
@@ -1275,9 +1275,9 @@ export class DdbObj {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
/** 构建 Tensor
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1278
|
+
@param buildParams 构建参数
|
|
1279
|
+
@param limit 限制每个维度最大元素个数(仅用于 log,不作他用)
|
|
1280
|
+
@returns */
|
|
1281
1281
|
static parse_tensor(buildParams, limit = -1) {
|
|
1282
1282
|
const { currentDim, dimensions, rawData, le, dataByte, dataType, shape, strides } = buildParams;
|
|
1283
1283
|
const tensor = [];
|
|
@@ -2435,13 +2435,13 @@ export class DdbTable extends DdbObj {
|
|
|
2435
2435
|
}
|
|
2436
2436
|
}
|
|
2437
2437
|
export function date2ms(date) {
|
|
2438
|
-
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点)
|
|
2439
|
-
// 本地的时区与实际的时间值相关,
|
|
2438
|
+
// 将 server 的本地时间 (以 ms 为单位,1970.01.01 00:00:00 作为零点) 作为 UTC-0 格式化为字符串,然后根据本地的时区解析这个字符串转换为 UTC-8
|
|
2439
|
+
// 本地的时区与实际的时间值相关,getTimezoneOffset() 可能会受到夏令时 (DST) 的影响,不能使用
|
|
2440
2440
|
// 得到的 utc 毫秒数交给 js date 或者 dayjs 去格式化
|
|
2441
2441
|
if (date === null || date === nulls.int32)
|
|
2442
2442
|
return null;
|
|
2443
2443
|
const ms = 1000 * 3600 * 24 * date;
|
|
2444
|
-
return
|
|
2444
|
+
return timestamp2ms(ms);
|
|
2445
2445
|
}
|
|
2446
2446
|
export function date2str(date, format = 'YYYY.MM.DD') {
|
|
2447
2447
|
return (date === null || date === nulls.int32) ?
|
|
@@ -2468,7 +2468,7 @@ export function time2ms(time) {
|
|
|
2468
2468
|
return (time === null || time === nulls.int32) ?
|
|
2469
2469
|
null
|
|
2470
2470
|
:
|
|
2471
|
-
|
|
2471
|
+
timestamp2ms(time);
|
|
2472
2472
|
}
|
|
2473
2473
|
export function time2str(time, format = 'HH:mm:ss.SSS') {
|
|
2474
2474
|
return (time === null || time === nulls.int32) ?
|
|
@@ -2480,7 +2480,7 @@ export function minute2ms(minute) {
|
|
|
2480
2480
|
if (minute === null || minute === nulls.int32)
|
|
2481
2481
|
return null;
|
|
2482
2482
|
const ms = 60 * 1000 * minute;
|
|
2483
|
-
return
|
|
2483
|
+
return timestamp2ms(ms);
|
|
2484
2484
|
}
|
|
2485
2485
|
export function minute2str(minute, format = 'HH:mm[m]') {
|
|
2486
2486
|
return (minute === null || minute === nulls.int32) ?
|
|
@@ -2492,7 +2492,7 @@ export function second2ms(second) {
|
|
|
2492
2492
|
if (second === null || second === nulls.int32)
|
|
2493
2493
|
return null;
|
|
2494
2494
|
const ms = 1000 * second;
|
|
2495
|
-
return
|
|
2495
|
+
return timestamp2ms(ms);
|
|
2496
2496
|
}
|
|
2497
2497
|
export function second2str(second, format = 'HH:mm:ss') {
|
|
2498
2498
|
return (second === null || second === nulls.int32) ?
|
|
@@ -2534,13 +2534,13 @@ export function datehour2ms(datehour) {
|
|
|
2534
2534
|
if (datehour === null || datehour === nulls.int32)
|
|
2535
2535
|
return null;
|
|
2536
2536
|
const ms = 1000 * 3600 * datehour;
|
|
2537
|
-
return
|
|
2537
|
+
return timestamp2ms(ms);
|
|
2538
2538
|
}
|
|
2539
2539
|
export function datehour2str(datehour, format = 'YYYY.MM.DDTHH') {
|
|
2540
2540
|
if (datehour === null || datehour === nulls.int32)
|
|
2541
2541
|
return 'null';
|
|
2542
2542
|
const ms = 1000 * 3600 * datehour;
|
|
2543
|
-
return dayjs(
|
|
2543
|
+
return dayjs(timestamp2ms(ms)).format(format);
|
|
2544
2544
|
}
|
|
2545
2545
|
/** parse timestamp string to bigint value
|
|
2546
2546
|
- str: timestamp string, 如果为空字符串或 'null' 会返回对应的空值 (nulls.int64)
|
|
@@ -2571,7 +2571,7 @@ export function nanotime2str(nanotime, format = 'HH:mm:ss.SSSSSSSSS') {
|
|
|
2571
2571
|
const i_nanosecond_start = format.indexOf('SSSSSSSSS', i_second_end);
|
|
2572
2572
|
assert(i_nanosecond_start !== -1, t('格式串必须包含纳秒的格式 (SSSSSSSSS)'));
|
|
2573
2573
|
const ms = Number(nanotime) / 1000000;
|
|
2574
|
-
return (dayjs(
|
|
2574
|
+
return (dayjs(timestamp2ms(ms)).format(format.slice(0, i_second_end)) +
|
|
2575
2575
|
format.slice(i_second_end, i_nanosecond_start) +
|
|
2576
2576
|
String(nanotime % 1000000000n).padStart(9, '0'));
|
|
2577
2577
|
}
|