dolphindb 0.0.14 → 2.0.501

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/index.d.ts CHANGED
@@ -81,17 +81,24 @@ export interface DdbArrayVectorBlock {
81
81
  export declare type DdbValue = null | boolean | number | [number, number] | bigint | string | string[] | Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbFunctionDefValue | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
82
82
  export declare type DdbVectorValue = string | string[] | Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array | BigInt64Array | Uint8Array[] | DdbObj[] | DdbSymbolExtendedValue | DdbArrayVectorBlock[];
83
83
  export declare const nulls: {
84
+ readonly bool: 128;
84
85
  readonly char: "€";
85
86
  readonly int16: -32768;
86
87
  readonly int32: -2147483648;
87
88
  readonly int64: -9223372036854775808n;
89
+ readonly float32: -3.4028234663852886e+38;
90
+ /** -Number.MAX_VALUE */
91
+ readonly double: number;
92
+ readonly bytes16: Uint8Array;
88
93
  };
89
94
  export declare const timezone_offset: number;
90
95
  /** 可以表示所有 DolphinDB 数据库中的数据类型 */
91
96
  export declare class DdbObj<T extends DdbValue = DdbValue> {
92
97
  static dec: TextDecoder;
93
98
  static enc: TextEncoder;
94
- /** 维护已解析的 symbol base,比如流数据中后续的 symbol 向量可能只发送一个 base.id, base.size == 0, 依赖之前发送的 symbol base */
99
+ /** 维护已解析的 symbol base,比如流数据中后续的 symbol 向量可能只发送一个 base.id, base.size == 0, 依赖之前发送的 symbol base ?
100
+ 只是暂存,如果一张表有多个 symbol 列,可能这个 symbol base 会被复用,不同的对象之间 symbol base 一般不复用
101
+ */
95
102
  static symbol_bases: Record<number, string[]>;
96
103
  /** little endian (client) */
97
104
  static le_client: boolean;
@@ -147,57 +154,85 @@ export declare class DdbVoid extends DdbObj<undefined> {
147
154
  constructor();
148
155
  }
149
156
  export declare class DdbBool extends DdbObj<boolean> {
150
- constructor(value: boolean);
157
+ constructor(value: boolean | null);
151
158
  }
152
159
  export declare class DdbChar extends DdbObj<string> {
153
- constructor(value: string);
160
+ constructor(value: string | null);
154
161
  }
155
162
  export declare class DdbInt extends DdbObj<number> {
156
- constructor(value: number);
163
+ constructor(value: number | null);
157
164
  }
158
165
  export declare class DdbString extends DdbObj<string> {
159
166
  constructor(value: string);
160
167
  }
161
168
  export declare class DdbLong extends DdbObj<bigint> {
162
- constructor(value: bigint);
169
+ constructor(value: bigint | null);
163
170
  }
164
171
  export declare class DdbDouble extends DdbObj<number> {
165
- constructor(value: number);
172
+ constructor(value: number | null);
166
173
  }
167
174
  export declare class DdbDateTime extends DdbObj<number> {
168
- constructor(value: number);
175
+ constructor(value: number | null);
169
176
  }
170
177
  export declare class DdbTimeStamp extends DdbObj<bigint> {
171
- constructor(value: bigint);
178
+ constructor(value: bigint | null);
172
179
  }
173
180
  export declare class DdbNanoTimeStamp extends DdbObj<bigint> {
174
- constructor(value: bigint);
181
+ constructor(value: bigint | null);
182
+ }
183
+ export declare class DdbPair extends DdbObj<Int32Array> {
184
+ constructor(l: number | null, r?: number | null);
185
+ }
186
+ export declare class DdbFunction extends DdbObj<DdbFunctionDefValue> {
187
+ constructor(name: string, type: DdbFunctionType);
175
188
  }
176
189
  export declare class DdbVectorInt extends DdbObj<Int32Array> {
177
- constructor(value: number[], name?: string);
190
+ constructor(ints: (number | null)[] | Int32Array, name?: string);
178
191
  }
179
192
  export declare class DdbVectorString extends DdbObj<string[]> {
180
- constructor(value: string[], name?: string);
193
+ constructor(strings: string[], name?: string);
181
194
  }
182
195
  export declare class DdbVectorDouble extends DdbObj<Float64Array> {
183
- constructor(value: number[], name?: string);
196
+ constructor(doubles: (number | null)[] | Float64Array, name?: string);
184
197
  }
185
198
  export declare class DdbVectorAny extends DdbObj {
186
- constructor(value: DdbObj<DdbValue>[], name?: string);
199
+ constructor(objs: DdbObj<DdbValue>[], name?: string);
187
200
  }
188
- export declare class DdbPair extends DdbObj<Int32Array> {
189
- constructor(l: number, r?: number);
201
+ export declare class DdbVectorSymbol extends DdbObj<DdbSymbolExtendedValue> {
202
+ constructor(strings: string[], name?: string);
190
203
  }
191
- export declare class DdbFunction extends DdbObj<DdbFunctionDefValue> {
192
- constructor(name: string, type: DdbFunctionType);
204
+ export declare class DdbTable extends DdbObj<DdbObj[]> {
205
+ constructor(columns: DdbObj[], name?: string);
193
206
  }
194
207
  export declare function date2str(date: number, format?: string): string;
195
208
  export declare function datetime2str(datetime: number, format?: string): string;
196
- export declare function timestamp2str(timestamp: bigint): string;
209
+ /** format timestamp (bigint) to string
210
+ - timestamp: bigint value
211
+ - format?:
212
+ format string, default to `YYYY.MM.DD HH:mm:ss.SSS`
213
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
214
+ */
215
+ export declare function timestamp2str(timestamp: bigint, format?: string): string;
216
+ /** parse timestamp string to bigint value
217
+ - str: timestamp string, If it is an empty string, it will return the corresponding empty value (nulls.int64)
218
+ - format?:
219
+ The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSS`
220
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
221
+ */
222
+ export declare function str2timestamp(str: string, format?: string): bigint;
223
+ /** format nanotimestamp value (bigint) to string
224
+ - nanotimestamp: bigint value
225
+ - format?:
226
+ format string, default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
227
+ Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
228
+ https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
229
+ */
197
230
  export declare function nanotimestamp2str(nanotimestamp: bigint, format?: string): string;
198
231
  /** parse nano timestamp string to bigint value
199
- - str: nano timestamp string, 如果为空字符串会返回对应的空值 (nulls.int64)
200
- - format?: 对应传入字符串的到秒之前 (包括) 的格式串,默认是 `YYYY.MM.DD HH:mm:ss`
232
+ - str: nano timestamp string, If it is an empty string, it will return the corresponding empty value (nulls.int64)
233
+ - format?:
234
+ The format string corresponding to the incoming string, the default is `YYYY.MM.DD HH:mm:ss.SSSSSSSSS`
235
+ Seconds are in the format ss (must be included); nanoseconds are in the format SSSSSSSSS (must be included)
201
236
  https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens
202
237
  */
203
238
  export declare function str2nanotimestamp(str: string, format?: string): bigint;
@@ -226,6 +261,7 @@ export declare class DDB {
226
261
  presolver(buf: Uint8Array): void;
227
262
  prejector(error: Error): void;
228
263
  presult: Promise<Uint8Array>;
264
+ get connected(): boolean;
229
265
  /**
230
266
  Initialize an instance of DolphinDB Client using the WebSocket URL
231
267
  (without establishing an actual network connection)
@@ -326,7 +362,7 @@ export declare class DDB {
326
362
  };
327
363
  /** 自动转换 js string, boolean 为 DdbObj */
328
364
  to_ddbobj(value: DdbObj | string | boolean): DdbObj;
329
- /** 转换 js 数组为 DdbObj[] (in place, 会修改原数组) */
365
+ /** 转换 js 数组为 DdbObj[] */
330
366
  to_ddbobjs(values: any[]): DdbObj<DdbValue>[];
331
367
  }
332
368
  export default DDB;