dolphindb 3.0.1 → 3.0.2
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 +2 -1
- package/browser.js +17 -6
- package/browser.js.map +1 -1
- package/i18n/dict.json +2 -2
- package/index.d.ts +6 -3
- package/index.js +21 -164
- package/index.js.map +1 -1
- package/package.json +5 -5
- package/test.d.ts +0 -1
- package/test.js +26 -15
- package/test.js.map +1 -1
- package/unused.d.ts +1 -0
- package/unused.js +473 -0
- package/unused.js.map +1 -0
package/browser.d.ts
CHANGED
|
@@ -181,6 +181,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
|
|
|
181
181
|
}): T;
|
|
182
182
|
}
|
|
183
183
|
export interface InspectOptions {
|
|
184
|
+
/** `false` */
|
|
184
185
|
colors?: boolean;
|
|
185
186
|
/** `null` decimal places 小数位数 */
|
|
186
187
|
decimals?: number;
|
|
@@ -191,7 +192,7 @@ export interface InspectOptions {
|
|
|
191
192
|
/** `true` 决定格式化后的数据是否有千分位 */
|
|
192
193
|
grouping?: boolean;
|
|
193
194
|
}
|
|
194
|
-
/** 根据 DdbType 格式化单个元素 (value) 为字符串
|
|
195
|
+
/** 根据 DdbType 格式化单个元素 (value) 为字符串 */
|
|
195
196
|
export declare function format(type: DdbType, value: DdbValue, le: boolean, options?: InspectOptions): string;
|
|
196
197
|
/** 格式化向量、集合中的第 index 项为字符串,空值返回 'null' 字符串 formatted vector, the index-th item in the collection is a string, a null value returns a 'null' string */
|
|
197
198
|
export declare function formati(obj: DdbVectorObj, index: number, options?: InspectOptions): string;
|
package/browser.js
CHANGED
|
@@ -120,6 +120,8 @@ export class DdbObj {
|
|
|
120
120
|
let i_start = i_items_start + len_items;
|
|
121
121
|
for (let i = 0; i < cols; i++) {
|
|
122
122
|
const type = buf_data[i_start];
|
|
123
|
+
if (type === DdbType.compress)
|
|
124
|
+
throw new Error(t('{{form}}<{{type}}> 暂时不支持解析', { form: 'table', type: 'compress' }));
|
|
123
125
|
let col = this.parse_vector(buf_data.subarray(i_start + 2), le, type);
|
|
124
126
|
col.length += 2;
|
|
125
127
|
col.name = colnames[i];
|
|
@@ -701,8 +703,16 @@ export class DdbObj {
|
|
|
701
703
|
});
|
|
702
704
|
return [8 * length, durations];
|
|
703
705
|
}
|
|
706
|
+
case DdbType.compress:
|
|
707
|
+
return [
|
|
708
|
+
length,
|
|
709
|
+
new Uint8Array(buf.buffer.slice(buf.byteOffset, buf.byteOffset + length))
|
|
710
|
+
];
|
|
704
711
|
default:
|
|
705
|
-
throw new Error(t('
|
|
712
|
+
throw new Error(t('{{form}}<{{type}}> 暂时不支持解析', {
|
|
713
|
+
form: 'vector',
|
|
714
|
+
type: String(DdbType[type] || type)
|
|
715
|
+
}));
|
|
706
716
|
}
|
|
707
717
|
}
|
|
708
718
|
pack() {
|
|
@@ -933,6 +943,7 @@ export class DdbObj {
|
|
|
933
943
|
case DdbType.uuid:
|
|
934
944
|
case DdbType.ipaddr:
|
|
935
945
|
case DdbType.int128:
|
|
946
|
+
case DdbType.compress:
|
|
936
947
|
return [value];
|
|
937
948
|
case DdbType.blob: {
|
|
938
949
|
let bufs = new Array(length * 2);
|
|
@@ -1111,7 +1122,7 @@ export class DdbObj {
|
|
|
1111
1122
|
return format_array(items, data.length > limit);
|
|
1112
1123
|
}
|
|
1113
1124
|
default: {
|
|
1114
|
-
const limit = 50;
|
|
1125
|
+
const limit = this.type === DdbType.compress ? 5 : 50;
|
|
1115
1126
|
let items = new Array(Math.min(limit, this.value.length));
|
|
1116
1127
|
for (let i = 0; i < items.length; i++)
|
|
1117
1128
|
items[i] = format(this.type, this.value[i], this.le, options);
|
|
@@ -1273,15 +1284,15 @@ export class DdbObj {
|
|
|
1273
1284
|
return obj;
|
|
1274
1285
|
}
|
|
1275
1286
|
}
|
|
1276
|
-
/** 整数一定用这个 number formatter, InspectOptions.decimals 不传也用这个
|
|
1287
|
+
/** 整数一定用这个 number formatter, InspectOptions.decimals 不传也用这个 */
|
|
1277
1288
|
let default_formatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
|
|
1278
1289
|
let _decimals = 20;
|
|
1279
1290
|
let _grouping = true;
|
|
1280
|
-
/** 缓存,为了优化性能,通常 options.decimals 都是不变的
|
|
1291
|
+
/** 缓存,为了优化性能,通常 options.decimals 都是不变的 */
|
|
1281
1292
|
let _formatter = new Intl.NumberFormat('en-US', { maximumFractionDigits: 20 });
|
|
1282
1293
|
/** 用来处理时差 To deal with jet lag */
|
|
1283
1294
|
let _datetime_formatter = new Intl.DateTimeFormat('zh-CN', { dateStyle: 'short', timeStyle: 'medium', timeZone: 'UTC', hour12: false });
|
|
1284
|
-
/** 根据 DdbType 格式化单个元素 (value) 为字符串
|
|
1295
|
+
/** 根据 DdbType 格式化单个元素 (value) 为字符串 */
|
|
1285
1296
|
export function format(type, value, le, options = {}) {
|
|
1286
1297
|
const { nullstr = false, colors = false, quote = false, grouping = true } = options;
|
|
1287
1298
|
const formatter = (() => {
|
|
@@ -2515,7 +2526,7 @@ export class DDB {
|
|
|
2515
2526
|
]));
|
|
2516
2527
|
});
|
|
2517
2528
|
if (this.verbose)
|
|
2518
|
-
console.log(result.toString() + rpc_id);
|
|
2529
|
+
console.log(result.toString({ quote: true, nullstr: true }) + rpc_id);
|
|
2519
2530
|
return result;
|
|
2520
2531
|
});
|
|
2521
2532
|
}
|