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/browser.d.ts CHANGED
@@ -163,6 +163,7 @@ export declare class DdbObj<TValue extends DdbValue = DdbValue> {
163
163
  dataIndex: string;
164
164
  render: (value: any) => string;
165
165
  }[];
166
+ /** 将 table 转换为 rows,空值转换为 null */
166
167
  to_rows<T extends Record<string, any> = Record<string, any>>(): T[];
167
168
  /** 将 dict<string, any> 自动转换为 js object (Record<string, any>) Automatically convert dict<string, any> to js object (Record<string, any>)
168
169
  - options?:
package/browser.js CHANGED
@@ -1176,6 +1176,7 @@ export class DdbObj {
1176
1176
  render: value => format(col.type, value, col.le, { nullstr: false, quote: false })
1177
1177
  }));
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;