duckdb / duckdb/duckdb-node-neo
Proper way of typing results
- Dominant language
- TypeScript
- Stars
- 197
- Forks
- 46
- Avg merge
- 15h 38m
- Merged PRs (30d)
- 22
Description
Hi,
From the documentation and especially the "Inspect Data Values" section, it's not clear for me how to get proper value typings based on column types.
From what I understand `columnType` and `columnValue` are coming from different function return (probably from `getColumnTypes()` and `value()` for instance).
I don't think there's a trivial way to get the data type inferred like that, so in your example do you suggest to cast the corresponding column value based on its column type ?
Example :
```typescript
if (columnTypes[0].typeId === DuckDBTypeId.VARCHAR) {
const value = result.value(0, 1) as DuckDBArrayValue; //fetching same column, row: 1
value.items // ok
}
```
Is there a better way using your api ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.