tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
289 stars 37 forks source link

Add `lastInsertRowid` to `ResultSet` #22

Closed honzasp closed 1 year ago

honzasp commented 1 year ago

The last inserted rowid is returned from Hrana and HTTP APIs. Let's expose it in the client, too.

The only possible issue is the type of the lastInsertRowid field. There are three options:

I decided to go for bigint, because it seems to be least likely to give trouble: it can represent all ROWIDs, and when passed back to SQLite, the client converts it to a string, which SQLite converts back to an integer. (Perhaps it would be better to convert JavaScript bigint to a SQLite integer (and throw an exception if it overflows), but this would break backwards compatibility, so let's do it in the next major release.)

honzasp commented 1 year ago

bors merge

bors[bot] commented 1 year ago

Build succeeded: