File
Blob: src/worker/db/sqlite.ts
| 1 | import { customType } from "drizzle-orm/sqlite-core"; |
| 2 | |
| 3 | export const sqliteBytes = customType<{ |
| 4 | data: Uint8Array; |
| 5 | driverData: ArrayBuffer | Uint8Array; |
| 6 | }>({ |
| 7 | dataType() { |
| 8 | return "blob"; |
| 9 | }, |
| 10 | toDriver(value) { |
| 11 | return value; |
| 12 | }, |
| 13 | fromDriver(value) { |
| 14 | return value instanceof Uint8Array ? value : new Uint8Array(value); |
| 15 | }, |
| 16 | }); |