feat(db): Bun.SQL Kysely dialect for sqlite and postgres

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-30 15:30:49 +01:00
1 parent 6c5a9fbad9
commit 8248a2ac27
11 files changed
+403 -1

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
/** Serialise a value for a JSON column (stored as text on both dialects). */
export function toJson(v: unknown): string {
return JSON.stringify(v);
}
/** Parse a JSON column, returning `fallback` for null, undefined or invalid text. */
export function fromJson<T>(s: string | null | undefined, fallback: T): T {
if (s == null) return fallback;
try {
return JSON.parse(s) as T;
} catch {
return fallback;
}
}