Skip to content

Proper way of typing results #140

Open
@jbuiquan

Description

@jbuiquan

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 :

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 ?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions