Skip to content
File

Blob: src/worker/db/sqlite.ts

typescript19 lines
1import { customType } from "drizzle-orm/sqlite-core";
2 
3const 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});
17 
18export const bytes = (name: string) => sqliteBytes(name);