tursodatabase / libsql-client-ts

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

Use Hrana 3 when available #68

Closed honzasp closed 1 year ago

honzasp commented 1 year ago

Upgrade to @libsql/hrana-client version 0.5 to transparently use Hrana 3 if the server supports it. This allows us to fix a hole in the transaction() and batch() APIs: previously, if the transaction was rolled back using ROLLBACK or using the OR ROLLBACK conflict resolution strategy, the following statements would be executed outside of a transaction. With Hrana 3, we can use hrana.BatchCond.isAutocommit() to fix this.

The Hrana client will also internally use cursors (streaming) to implement batches. This means that the server does not have load the full result set into memory before sending it, which reduces memory pressure. However, the client API is unchanged, so the client will still keep all results in memory.