dolphindb 2.0.503 → 2.0.504
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/README.md +37 -32
- package/README.zh.md +29 -24
- package/browser.d.ts +14 -3
- package/browser.js +76 -15
- package/browser.js.map +1 -1
- package/index.d.ts +14 -3
- package/index.js +76 -15
- package/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,23 +54,24 @@ let ddb = new DDB('ws://127.0.0.1:8848')
|
|
|
54
54
|
await ddb.connect()
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
####
|
|
57
|
+
#### DDB options
|
|
58
58
|
```ts
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
60
|
+
|
|
61
|
+
// Encrypt with HTTPS
|
|
62
|
+
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
63
|
+
// Whether to log in automatically after establishing a connection, default `true`
|
|
64
|
+
autologin: true,
|
|
65
|
+
|
|
66
|
+
// DolphinDB username, default `'admin'`
|
|
67
|
+
username: 'admin',
|
|
68
|
+
|
|
69
|
+
// DolphinDB password, default `'123456'`
|
|
70
|
+
password: '123456',
|
|
71
|
+
|
|
72
|
+
// set python session flag, default `false`
|
|
73
|
+
python: false
|
|
74
|
+
})
|
|
74
75
|
```
|
|
75
76
|
|
|
76
77
|
|
|
@@ -187,37 +188,41 @@ enum DdbType {
|
|
|
187
188
|
}
|
|
188
189
|
```
|
|
189
190
|
|
|
190
|
-
#####
|
|
191
|
+
##### If there is no shortcut class, you can also specify form and type to manually create a DdbObj object
|
|
191
192
|
```ts
|
|
193
|
+
// Created by the DdbDateTime shortcut class
|
|
194
|
+
new DdbDateTime(1644573600)
|
|
195
|
+
|
|
196
|
+
// Equivalent to manually creating an object of form = scalar, type = datetime through DdbObj
|
|
192
197
|
const obj = new DdbObj({
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
form: DdbForm.scalar,
|
|
199
|
+
type: DdbType.datetime,
|
|
200
|
+
value: 1644573600,
|
|
201
|
+
length: 0
|
|
197
202
|
})
|
|
198
|
-
```
|
|
199
203
|
|
|
200
|
-
The corresponding type and value of value property in js can refer to the result returned by `ddb.eval` (see below: `eval` Method Declaration)
|
|
201
204
|
|
|
202
|
-
|
|
205
|
+
// The corresponding type and value of value in js can refer to the result returned by ddb.eval (see the `eval` method declaration below)
|
|
203
206
|
const obj = await ddb.eval('2022.02.11 10:00:00')
|
|
204
207
|
console.log(obj.form === DdbForm.scalar)
|
|
205
208
|
console.log(obj.type === DdbType.datetime)
|
|
206
209
|
console.log(obj.value)
|
|
207
|
-
```
|
|
208
210
|
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
+
// Another example is to create a set
|
|
211
212
|
// refer to ddb.eval
|
|
212
213
|
// const obj = await ddb.eval('set([1, 2, 3])')
|
|
213
214
|
// console.log(obj.value)
|
|
214
|
-
|
|
215
215
|
const obj = new DdbObj({
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
form: DdbForm.set,
|
|
217
|
+
type: DdbType.int,
|
|
218
|
+
value: Int32Array.of(1, 2, 3),
|
|
219
|
+
length: 0
|
|
220
220
|
})
|
|
221
|
+
|
|
222
|
+
// It's easier to use shortcut classes
|
|
223
|
+
const obj = new DdbSetInt(
|
|
224
|
+
new Set([1, 2, 3])
|
|
225
|
+
)
|
|
221
226
|
```
|
|
222
227
|
|
|
223
228
|
##### NULL object in the form of scalar, the value corresponding to DdbObj is null in JavaScript
|
package/README.zh.md
CHANGED
|
@@ -55,23 +55,24 @@ let ddb = new DDB('ws://127.0.0.1:8848')
|
|
|
55
55
|
await ddb.connect()
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
####
|
|
58
|
+
#### DDB 选项
|
|
59
59
|
```ts
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
61
|
+
|
|
62
|
+
// 使用 HTTPS 加密
|
|
63
|
+
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
64
|
+
// 是否在建立连接后自动登录,默认 `true`
|
|
65
|
+
autologin: true,
|
|
66
|
+
|
|
67
|
+
// DolphinDB 登录用户名,默认 `'admin'`
|
|
68
|
+
username: 'admin',
|
|
69
|
+
|
|
70
|
+
// DolphinDB 登录密码,默认 `'123456'`
|
|
71
|
+
password: '123456',
|
|
72
|
+
|
|
73
|
+
// 设置 python session flag,默认 `false`
|
|
74
|
+
python: false
|
|
75
|
+
})
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
|
|
@@ -188,37 +189,41 @@ enum DdbType {
|
|
|
188
189
|
}
|
|
189
190
|
```
|
|
190
191
|
|
|
191
|
-
#####
|
|
192
|
+
##### 没有快捷类的类型,也可以指定 form 和 type 手动创建 DdbObj 对象
|
|
192
193
|
```ts
|
|
194
|
+
// 通过 DdbDateTime 快捷类创建
|
|
195
|
+
new DdbDateTime(1644573600)
|
|
196
|
+
|
|
197
|
+
// 等价于手动通过 DdbObj 创建 form = scalar, type = datetime 的对象
|
|
193
198
|
const obj = new DdbObj({
|
|
194
199
|
form: DdbForm.scalar,
|
|
195
200
|
type: DdbType.datetime,
|
|
196
201
|
value: 1644573600,
|
|
197
202
|
length: 0
|
|
198
203
|
})
|
|
199
|
-
```
|
|
200
204
|
|
|
201
|
-
value 的在 js 中对应类型及取值可以参考 ddb.eval 返回的结果 (见后文 `eval` 方法声明)
|
|
202
205
|
|
|
203
|
-
|
|
206
|
+
// value 在 js 中对应类型及取值可以参考 ddb.eval 返回的结果 (见后文 `eval` 方法声明)
|
|
204
207
|
const obj = await ddb.eval('2022.02.11 10:00:00')
|
|
205
208
|
console.log(obj.form === DdbForm.scalar)
|
|
206
209
|
console.log(obj.type === DdbType.datetime)
|
|
207
210
|
console.log(obj.value)
|
|
208
|
-
```
|
|
209
211
|
|
|
210
|
-
|
|
211
|
-
```ts
|
|
212
|
+
// 再比如创建一个 set
|
|
212
213
|
// 参考 ddb.eval
|
|
213
214
|
// const obj = await ddb.eval('set([1, 2, 3])')
|
|
214
215
|
// console.log(obj.value)
|
|
215
|
-
|
|
216
216
|
const obj = new DdbObj({
|
|
217
217
|
form: DdbForm.set,
|
|
218
218
|
type: DdbType.int,
|
|
219
219
|
value: Int32Array.of(1, 2, 3),
|
|
220
220
|
length: 0
|
|
221
221
|
})
|
|
222
|
+
|
|
223
|
+
// 使用快捷类较为简单
|
|
224
|
+
const obj = new DdbSetInt(
|
|
225
|
+
new Set([1, 2, 3])
|
|
226
|
+
)
|
|
222
227
|
```
|
|
223
228
|
|
|
224
229
|
##### scalar 形式的 NULL 对象, 对应 DdbObj 的 value 为 JavaScript 中的 null
|
package/browser.d.ts
CHANGED
|
@@ -191,18 +191,27 @@ export declare class DdbFunction extends DdbObj<DdbFunctionDefValue> {
|
|
|
191
191
|
export declare class DdbVectorInt extends DdbObj<Int32Array> {
|
|
192
192
|
constructor(ints: (number | null)[] | Int32Array, name?: string);
|
|
193
193
|
}
|
|
194
|
-
export declare class DdbVectorString extends DdbObj<string[]> {
|
|
195
|
-
constructor(strings: string[], name?: string);
|
|
196
|
-
}
|
|
197
194
|
export declare class DdbVectorDouble extends DdbObj<Float64Array> {
|
|
198
195
|
constructor(doubles: (number | null)[] | Float64Array, name?: string);
|
|
199
196
|
}
|
|
197
|
+
export declare class DdbVectorString extends DdbObj<string[]> {
|
|
198
|
+
constructor(strings: string[], name?: string);
|
|
199
|
+
}
|
|
200
200
|
export declare class DdbVectorAny extends DdbObj {
|
|
201
201
|
constructor(objs: DdbObj<DdbValue>[], name?: string);
|
|
202
202
|
}
|
|
203
203
|
export declare class DdbVectorSymbol extends DdbObj<DdbSymbolExtendedValue> {
|
|
204
204
|
constructor(strings: string[], name?: string);
|
|
205
205
|
}
|
|
206
|
+
export declare class DdbSetInt extends DdbObj<Int32Array> {
|
|
207
|
+
constructor(ints: (number | null)[] | Set<number> | Int32Array);
|
|
208
|
+
}
|
|
209
|
+
export declare class DdbSetDouble extends DdbObj<Float64Array> {
|
|
210
|
+
constructor(doubles: (number | null)[] | Set<number> | Float64Array);
|
|
211
|
+
}
|
|
212
|
+
export declare class DdbSetString extends DdbObj<string[]> {
|
|
213
|
+
constructor(strings: string[] | Set<string>);
|
|
214
|
+
}
|
|
206
215
|
export declare class DdbTable extends DdbObj<DdbObj[]> {
|
|
207
216
|
constructor(columns: DdbObj[], name?: string);
|
|
208
217
|
}
|
|
@@ -281,6 +290,8 @@ export declare class DDB {
|
|
|
281
290
|
|
|
282
291
|
@example
|
|
283
292
|
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
293
|
+
|
|
294
|
+
// 使用 HTTPS 加密
|
|
284
295
|
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
285
296
|
autologin: true,
|
|
286
297
|
username: 'admin',
|
package/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ddb = exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.
|
|
3
|
+
exports.ddb = exports.DDB = exports.str2nanotimestamp = exports.nanotimestamp2str = exports.str2timestamp = exports.timestamp2str = exports.datetime2str = exports.date2str = exports.DdbTable = exports.DdbSetString = exports.DdbSetDouble = exports.DdbSetInt = exports.DdbVectorSymbol = exports.DdbVectorAny = exports.DdbVectorString = exports.DdbVectorDouble = exports.DdbVectorInt = exports.DdbFunction = exports.DdbPair = exports.DdbNanoTimeStamp = exports.DdbTimeStamp = exports.DdbDateTime = exports.DdbDouble = exports.DdbLong = exports.DdbString = exports.DdbInt = exports.DdbChar = exports.DdbBool = exports.DdbVoid = exports.DdbObj = exports.timezone_offset = exports.nulls = exports.DdbFunctionType = exports.DdbType = exports.DdbForm = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
6
|
const customParseFormat_js_1 = tslib_1.__importDefault(require("dayjs/plugin/customParseFormat.js"));
|
|
@@ -1075,20 +1075,6 @@ class DdbVectorInt extends DdbObj {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
1077
|
exports.DdbVectorInt = DdbVectorInt;
|
|
1078
|
-
class DdbVectorString extends DdbObj {
|
|
1079
|
-
constructor(strings, name) {
|
|
1080
|
-
super({
|
|
1081
|
-
form: DdbForm.vector,
|
|
1082
|
-
type: DdbType.string,
|
|
1083
|
-
length: 0,
|
|
1084
|
-
rows: strings.length,
|
|
1085
|
-
cols: 1,
|
|
1086
|
-
value: strings,
|
|
1087
|
-
name,
|
|
1088
|
-
});
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
exports.DdbVectorString = DdbVectorString;
|
|
1092
1078
|
class DdbVectorDouble extends DdbObj {
|
|
1093
1079
|
constructor(doubles, name) {
|
|
1094
1080
|
super({
|
|
@@ -1109,6 +1095,20 @@ class DdbVectorDouble extends DdbObj {
|
|
|
1109
1095
|
}
|
|
1110
1096
|
}
|
|
1111
1097
|
exports.DdbVectorDouble = DdbVectorDouble;
|
|
1098
|
+
class DdbVectorString extends DdbObj {
|
|
1099
|
+
constructor(strings, name) {
|
|
1100
|
+
super({
|
|
1101
|
+
form: DdbForm.vector,
|
|
1102
|
+
type: DdbType.string,
|
|
1103
|
+
length: 0,
|
|
1104
|
+
rows: strings.length,
|
|
1105
|
+
cols: 1,
|
|
1106
|
+
value: strings,
|
|
1107
|
+
name,
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
exports.DdbVectorString = DdbVectorString;
|
|
1112
1112
|
class DdbVectorAny extends DdbObj {
|
|
1113
1113
|
constructor(objs, name) {
|
|
1114
1114
|
super({
|
|
@@ -1154,6 +1154,65 @@ class DdbVectorSymbol extends DdbObj {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
exports.DdbVectorSymbol = DdbVectorSymbol;
|
|
1157
|
+
class DdbSetInt extends DdbObj {
|
|
1158
|
+
constructor(ints) {
|
|
1159
|
+
super({
|
|
1160
|
+
form: DdbForm.set,
|
|
1161
|
+
type: DdbType.int,
|
|
1162
|
+
length: 0,
|
|
1163
|
+
rows: ints instanceof Set ?
|
|
1164
|
+
ints.size
|
|
1165
|
+
:
|
|
1166
|
+
ints.length,
|
|
1167
|
+
cols: 1,
|
|
1168
|
+
value: ints instanceof Int32Array ?
|
|
1169
|
+
ints
|
|
1170
|
+
:
|
|
1171
|
+
Int32Array.from(ints, v => v === null ?
|
|
1172
|
+
exports.nulls.int32
|
|
1173
|
+
:
|
|
1174
|
+
v),
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
exports.DdbSetInt = DdbSetInt;
|
|
1179
|
+
class DdbSetDouble extends DdbObj {
|
|
1180
|
+
constructor(doubles) {
|
|
1181
|
+
super({
|
|
1182
|
+
form: DdbForm.set,
|
|
1183
|
+
type: DdbType.double,
|
|
1184
|
+
length: 0,
|
|
1185
|
+
rows: doubles instanceof Set ?
|
|
1186
|
+
doubles.size
|
|
1187
|
+
:
|
|
1188
|
+
doubles.length,
|
|
1189
|
+
cols: 1,
|
|
1190
|
+
value: doubles instanceof Int32Array ?
|
|
1191
|
+
doubles
|
|
1192
|
+
:
|
|
1193
|
+
Int32Array.from(doubles, v => v === null ?
|
|
1194
|
+
exports.nulls.int32
|
|
1195
|
+
:
|
|
1196
|
+
v),
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
exports.DdbSetDouble = DdbSetDouble;
|
|
1201
|
+
class DdbSetString extends DdbObj {
|
|
1202
|
+
constructor(strings) {
|
|
1203
|
+
if (strings instanceof Set)
|
|
1204
|
+
strings = [...strings];
|
|
1205
|
+
super({
|
|
1206
|
+
form: DdbForm.set,
|
|
1207
|
+
type: DdbType.string,
|
|
1208
|
+
length: 0,
|
|
1209
|
+
rows: strings.length,
|
|
1210
|
+
cols: 1,
|
|
1211
|
+
value: strings
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
exports.DdbSetString = DdbSetString;
|
|
1157
1216
|
class DdbTable extends DdbObj {
|
|
1158
1217
|
constructor(columns, name = '') {
|
|
1159
1218
|
super({
|
|
@@ -1270,6 +1329,8 @@ class DDB {
|
|
|
1270
1329
|
|
|
1271
1330
|
@example
|
|
1272
1331
|
let ddb = new DDB('ws://127.0.0.1:8848')
|
|
1332
|
+
|
|
1333
|
+
// 使用 HTTPS 加密
|
|
1273
1334
|
let ddbsecure = new DDB('wss://dolphindb.com', {
|
|
1274
1335
|
autologin: true,
|
|
1275
1336
|
username: 'admin',
|