dolphindb 2.0.1024 → 2.0.1025

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
@@ -158,6 +158,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
158
158
  static to_ddbobj(value: DdbObj | string | boolean): DdbObj;
159
159
  /** 转换 js 数组为 DdbObj[] */
160
160
  static to_ddbobjs(values: (DdbObj | string | boolean)[]): DdbObj<DdbValue>[];
161
+ /** 将 table 转换为 rows,空值转换为 null */
161
162
  to_rows<T extends Record<string, any> = Record<string, any>>(): T[];
162
163
  /** 将 dict<string, any> 自动转换为 js object (Record<string, any>) Automatically convert dict<string, any> to js object (Record<string, any>)
163
164
  - options?:
package/index.js CHANGED
@@ -1176,6 +1176,7 @@ export class DdbObj {
1176
1176
  static to_ddbobjs(values) {
1177
1177
  return values.map(value => this.to_ddbobj(value));
1178
1178
  }
1179
+ /** 将 table 转换为 rows,空值转换为 null */
1179
1180
  to_rows() {
1180
1181
  assert(this.form === DdbForm.table, t('form 必须是 DdbForm.table, 否则不能 to_rows'));
1181
1182
  let rows = new Array(this.rows);
@@ -1192,6 +1193,42 @@ export class DdbObj {
1192
1193
  Boolean(value);
1193
1194
  break;
1194
1195
  }
1196
+ case DdbType.char:
1197
+ row[name] = values[i] === nulls.int8 ? null : values[i];
1198
+ break;
1199
+ case DdbType.short:
1200
+ row[name] = values[i] === nulls.int16 ? null : values[i];
1201
+ break;
1202
+ case DdbType.int:
1203
+ case DdbType.date:
1204
+ case DdbType.month:
1205
+ case DdbType.time:
1206
+ case DdbType.minute:
1207
+ case DdbType.second:
1208
+ case DdbType.datetime:
1209
+ case DdbType.datehour:
1210
+ row[name] = values[i] === nulls.int32 ? null : values[i];
1211
+ break;
1212
+ case DdbType.long:
1213
+ case DdbType.timestamp:
1214
+ case DdbType.nanotime:
1215
+ case DdbType.nanotimestamp:
1216
+ row[name] = values[i] === nulls.int64 ? null : values[i];
1217
+ break;
1218
+ case DdbType.int128:
1219
+ row[name] = values[i] === nulls.int128 ? null : values[i];
1220
+ break;
1221
+ case DdbType.float:
1222
+ row[name] = values[i] === nulls.float32 ? null : values[i];
1223
+ break;
1224
+ case DdbType.double:
1225
+ row[name] = values[i] === nulls.double ? null : values[i];
1226
+ break;
1227
+ case DdbType.decimal32:
1228
+ case DdbType.decimal64:
1229
+ case DdbType.decimal128:
1230
+ row[name] = is_decimal_null_value(type, values[i]) ? null : values[i];
1231
+ break;
1195
1232
  case DdbType.ipaddr:
1196
1233
  row[name] = values.subarray(16 * i, 16 * (i + 1));
1197
1234
  break;