drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.57k stars 490 forks source link

Fix Bun Sqlite JSONb parsing #2355

Open zackify opened 1 month ago

zackify commented 1 month ago

I am not sure if this is the correct place to have this fix.

Better-sqlite3 adapter returns a "Buffer" for jsonb fields in the all function.

Bun sqlite is returning an U8IntArray.

This breaks json parsing in drizzle when querying for jsonb records.

The fix I did, just converts the u8intarrays to buffers which drizzle is expecting, now I can query and return json with bun correctly.