Repository Public
1import postgres from "postgres";2import { env } from "./env";34declare global { var __clipSql: ReturnType<typeof postgres> | undefined; }56export const sql = globalThis.__clipSql ?? (globalThis.__clipSql = postgres(env.databaseUrl, {7 max: 10, idle_timeout: 30, onnotice: () => {},8 types: { numeric: { to: 1700, from: [1700], serialize: (x: number) => String(x), parse: (x: string) => Number(x) } },9}));1011export type Sql = typeof sql;12/** JSON value for a jsonb column. */13export const j = (v: unknown) => sql.json(v as never);14