sqlc-dev / sqlc-gen-typescript

364 stars 17 forks source link

execlastid doesn't respect `support_big_numbers` #22

Open yshrsmz opened 9 months ago

yshrsmz commented 9 months ago

related: #13, #15

https://github.com/sqlc-dev/sqlc-gen-typescript/blob/1a42ab0ef40a8ed47e379fa7677fcedc5fe92150/examples/node-mysql2/src/db/query_sql.ts#L94-L100

This method should return string as support_big_numbers and big_number_strings is enabled in sqlc.dev.yml

https://github.com/sqlc-dev/sqlc-gen-typescript/blob/1a42ab0ef40a8ed47e379fa7677fcedc5fe92150/examples/sqlc.dev.yaml#L43-L54

This is because I explicitly declared a return type as number here

https://github.com/sqlc-dev/sqlc-gen-typescript/pull/13/files#diff-2078b150759ca61c4ae2bb37cb070f5a2d81e64c7b4d1aa126f621e2520f13d0R641-R643

but should respect PK's type.

yshrsmz commented 9 months ago

@kyleconroy How can I find out PK's type? I checked every value in GenerateRequest, but could not find one.

AFAIK, we can return Promise<string | number> from :execlastid, but it's not possible to define explicit type with current information.