Closed maxicapodacqua closed 1 year ago
The SqliteReturn type uses a tuple for the rows:
interface SqliteReturn { columns: string[], rows: [ [SqliteValue] ] }
This makes parsing results more complicated when you need to manipulate it as an array (when you expect more than one row. I suggest changing the response type to be:
interface SqliteReturn { columns: string[], rows: SqliteValue[] }
Or maybe something more suitable for different types, following the example of Planetscale: https://github.com/planetscale/database-js/blob/488e48b04cfb25b001050d6dbeebe8dd9b0a6f65/src/index.ts#L7
type Row = Record<string, any> | any[]
Thanks for reporting this @maxicapodacqua - We will look into switching to something similar to Planetscale.
The SqliteReturn type uses a tuple for the rows:
This makes parsing results more complicated when you need to manipulate it as an array (when you expect more than one row. I suggest changing the response type to be:
Or maybe something more suitable for different types, following the example of Planetscale: https://github.com/planetscale/database-js/blob/488e48b04cfb25b001050d6dbeebe8dd9b0a6f65/src/index.ts#L7