dolphindb 2.0.513 → 2.0.514

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 CHANGED
@@ -10,6 +10,10 @@ export declare enum DdbForm {
10
10
  chart = 7,
11
11
  chunk = 8
12
12
  }
13
+ /** DolphinDB DataType
14
+ 对应的 array vector 类型为 64 + 基本类型
15
+ 对应的 extended 类型为 128 + 基本类型
16
+ */
13
17
  export declare enum DdbType {
14
18
  void = 0,
15
19
  bool = 1,
@@ -91,7 +95,7 @@ export interface DdbArrayVectorBlock {
91
95
  unit: 1 | 2 | 4;
92
96
  rows: number;
93
97
  lengths: Uint8Array | Uint16Array | Uint32Array;
94
- data: DdbVectorValue;
98
+ data: Int8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array;
95
99
  }
96
100
  export interface DdbMatrixValue {
97
101
  rows: DdbObj<DdbVectorValue>;
@@ -473,4 +477,3 @@ export interface DdbErrorMessage {
473
477
  }
474
478
  export declare type DdbMessage = DdbPrintMessage | DdbObjectMessage | DdbErrorMessage;
475
479
  export declare let ddb: DDB;
476
- export default ddb;
package/browser.js CHANGED
@@ -20,6 +20,10 @@ var DdbForm;
20
20
  DdbForm[DdbForm["chart"] = 7] = "chart";
21
21
  DdbForm[DdbForm["chunk"] = 8] = "chunk";
22
22
  })(DdbForm = exports.DdbForm || (exports.DdbForm = {}));
23
+ /** DolphinDB DataType
24
+ 对应的 array vector 类型为 64 + 基本类型
25
+ 对应的 extended 类型为 128 + 基本类型
26
+ */
23
27
  var DdbType;
24
28
  (function (DdbType) {
25
29
  DdbType[DdbType["void"] = 0] = "void";
@@ -471,7 +475,7 @@ class DdbObj {
471
475
  unit,
472
476
  rows,
473
477
  lengths,
474
- data
478
+ data: data
475
479
  });
476
480
  i_block_start = i_data_start + len_items;
477
481
  i_row += rows;
@@ -929,6 +933,34 @@ class DdbObj {
929
933
  :
930
934
  str_items.bracket('square');
931
935
  }
936
+ if (64 <= this.type && this.type < 128) { // array vector
937
+ // 因为 array vector 目前只支持:Logical, Integral(不包括 INT128, COMPRESS 类型), Floating, Temporal
938
+ // 都对应 TypedArray 中的一格,所以直接根据 index 去取即可
939
+ // av = array(INT[], 0, 5)
940
+ // append!(av, [1..1])
941
+ // append!(av, [1..70000])
942
+ // append!(av, [1..1])
943
+ // append!(av, [1..500])
944
+ // ...
945
+ // av
946
+ const _type = this.type - 64;
947
+ const limit = 10;
948
+ let items = new Array(Math.min(limit, this.rows));
949
+ let i_items = 0;
950
+ for (const { lengths, data } of this.value) {
951
+ let acc_len = 0;
952
+ for (const length of lengths) {
953
+ let _items = new Array(Math.min(limit, length));
954
+ for (let i = 0; i < _items.length; i++)
955
+ _items[i] = format(_type, data[acc_len + i], this.le);
956
+ items[i_items++] = format_array(_items, length > limit);
957
+ acc_len += length;
958
+ }
959
+ if (i_items >= limit)
960
+ break;
961
+ }
962
+ return format_array(items, this.rows > limit);
963
+ }
932
964
  switch (this.type) {
933
965
  case DdbType.symbol_extended: {
934
966
  const limit = 50;
@@ -2049,5 +2081,4 @@ exports.DDB = DDB;
2049
2081
  /** little endian (client) */
2050
2082
  DDB.le_client = Boolean(new Uint8Array(Uint32Array.of(1).buffer)[0]);
2051
2083
  exports.ddb = window.ddb = new DDB();
2052
- exports.default = exports.ddb;
2053
2084
  //# sourceMappingURL=browser.js.map