dolphindb 0.0.9 → 0.0.10
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 -8
- package/browser.js.map +1 -1
- package/index.d.ts +5 -5
- package/index.js +20 -16
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -137,8 +137,8 @@ export declare class DdbObj<T extends DdbValue = DdbValue> {
|
|
|
137
137
|
];
|
|
138
138
|
pack(): Uint8Array;
|
|
139
139
|
static pack_vector_body(value: DdbVectorValue, type: DdbType, length: number): ArrayBufferView[];
|
|
140
|
-
to_dict<T = Record<string, any>>(): T;
|
|
141
140
|
[inspect.custom](): string;
|
|
141
|
+
to_dict<T = Record<string, any>>(): T;
|
|
142
142
|
}
|
|
143
143
|
export declare class DdbVoid extends DdbObj<undefined> {
|
|
144
144
|
constructor();
|
|
@@ -159,16 +159,16 @@ export declare class DdbDouble extends DdbObj<number> {
|
|
|
159
159
|
constructor(value: number);
|
|
160
160
|
}
|
|
161
161
|
export declare class DdbVectorInt extends DdbObj<Int32Array> {
|
|
162
|
-
constructor(value: number[]);
|
|
162
|
+
constructor(value: number[], name?: string);
|
|
163
163
|
}
|
|
164
164
|
export declare class DdbVectorString extends DdbObj<string[]> {
|
|
165
|
-
constructor(value: string[]);
|
|
165
|
+
constructor(value: string[], name?: string);
|
|
166
166
|
}
|
|
167
167
|
export declare class DdbVectorDouble extends DdbObj<Float64Array> {
|
|
168
|
-
constructor(value: number[]);
|
|
168
|
+
constructor(value: number[], name?: string);
|
|
169
169
|
}
|
|
170
170
|
export declare class DdbVectorAny extends DdbObj {
|
|
171
|
-
constructor(value: DdbObj<DdbValue>[]);
|
|
171
|
+
constructor(value: DdbObj<DdbValue>[], name?: string);
|
|
172
172
|
}
|
|
173
173
|
export declare class DdbPair extends DdbObj<Int32Array> {
|
|
174
174
|
constructor(l: number, r?: number);
|
package/index.js
CHANGED
|
@@ -808,15 +808,6 @@ class DdbObj {
|
|
|
808
808
|
throw new Error(`vector ${DdbType[type]} 暂不支持序列化`);
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
to_dict() {
|
|
812
|
-
if (this.form !== DdbForm.dict)
|
|
813
|
-
throw new Error('this.form 不是 dict, 不能转换为 Object');
|
|
814
|
-
const [{ value: keys }, { value: values }] = this.value;
|
|
815
|
-
let obj = {};
|
|
816
|
-
for (let i = 0; i < this.rows; i++)
|
|
817
|
-
obj[keys[i]] = values[i].value;
|
|
818
|
-
return obj;
|
|
819
|
-
}
|
|
820
811
|
[utils_js_1.inspect.custom]() {
|
|
821
812
|
const type = (() => {
|
|
822
813
|
const tname = DdbType[this.type];
|
|
@@ -854,6 +845,15 @@ class DdbObj {
|
|
|
854
845
|
})();
|
|
855
846
|
return `${type.blue}(${this.name ? `${(0, utils_js_1.inspect)(this.name)}, ` : ''}${data})`;
|
|
856
847
|
}
|
|
848
|
+
to_dict() {
|
|
849
|
+
if (this.form !== DdbForm.dict)
|
|
850
|
+
throw new Error('this.form is not DdbForm.dict, cannot convert to Object');
|
|
851
|
+
const [{ value: keys }, { value: values }] = this.value;
|
|
852
|
+
let obj = {};
|
|
853
|
+
for (let i = 0; i < this.rows; i++)
|
|
854
|
+
obj[keys[i]] = values[i].value;
|
|
855
|
+
return obj;
|
|
856
|
+
}
|
|
857
857
|
}
|
|
858
858
|
exports.DdbObj = DdbObj;
|
|
859
859
|
DdbObj.dec = new TextDecoder('utf-8');
|
|
@@ -928,7 +928,7 @@ class DdbDouble extends DdbObj {
|
|
|
928
928
|
}
|
|
929
929
|
exports.DdbDouble = DdbDouble;
|
|
930
930
|
class DdbVectorInt extends DdbObj {
|
|
931
|
-
constructor(value) {
|
|
931
|
+
constructor(value, name) {
|
|
932
932
|
super({
|
|
933
933
|
form: DdbForm.vector,
|
|
934
934
|
type: DdbType.int,
|
|
@@ -936,45 +936,49 @@ class DdbVectorInt extends DdbObj {
|
|
|
936
936
|
rows: value.length,
|
|
937
937
|
cols: 1,
|
|
938
938
|
value: Int32Array.from(value),
|
|
939
|
+
name,
|
|
939
940
|
});
|
|
940
941
|
}
|
|
941
942
|
}
|
|
942
943
|
exports.DdbVectorInt = DdbVectorInt;
|
|
943
944
|
class DdbVectorString extends DdbObj {
|
|
944
|
-
constructor(value) {
|
|
945
|
+
constructor(value, name) {
|
|
945
946
|
super({
|
|
946
947
|
form: DdbForm.vector,
|
|
947
948
|
type: DdbType.string,
|
|
948
949
|
length: 0,
|
|
949
950
|
rows: value.length,
|
|
950
951
|
cols: 1,
|
|
951
|
-
value
|
|
952
|
+
value,
|
|
953
|
+
name,
|
|
952
954
|
});
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
957
|
exports.DdbVectorString = DdbVectorString;
|
|
956
958
|
class DdbVectorDouble extends DdbObj {
|
|
957
|
-
constructor(value) {
|
|
959
|
+
constructor(value, name) {
|
|
958
960
|
super({
|
|
959
961
|
form: DdbForm.vector,
|
|
960
962
|
type: DdbType.double,
|
|
961
963
|
length: 0,
|
|
962
964
|
rows: value.length,
|
|
963
965
|
cols: 1,
|
|
964
|
-
value: Float64Array.from(value)
|
|
966
|
+
value: Float64Array.from(value),
|
|
967
|
+
name,
|
|
965
968
|
});
|
|
966
969
|
}
|
|
967
970
|
}
|
|
968
971
|
exports.DdbVectorDouble = DdbVectorDouble;
|
|
969
972
|
class DdbVectorAny extends DdbObj {
|
|
970
|
-
constructor(value) {
|
|
973
|
+
constructor(value, name) {
|
|
971
974
|
super({
|
|
972
975
|
form: DdbForm.vector,
|
|
973
976
|
type: DdbType.any,
|
|
974
977
|
length: 0,
|
|
975
978
|
rows: value.length,
|
|
976
979
|
cols: 1,
|
|
977
|
-
value
|
|
980
|
+
value,
|
|
981
|
+
name,
|
|
978
982
|
});
|
|
979
983
|
}
|
|
980
984
|
}
|